Module: FileColumn::FileCompat

Defined in:
lib/file_compat.rb

Overview

This bit of code allows you to pass regular old files to file_column. file_column depends on a few extra methods that the CGI uploaded file class adds. We will add the equivalent methods to file objects if necessary by extending them with this module. This avoids opening up the standard File class which might result in naming conflicts.

Instance Method Summary (collapse)

Instance Method Details

- (Object) content_type



23
24
25
# File 'lib/file_compat.rb', line 23

def content_type
  nil
end

- (Object) local_path



19
20
21
# File 'lib/file_compat.rb', line 19

def local_path
  path
end

- (Object) original_filename



11
12
13
# File 'lib/file_compat.rb', line 11

def original_filename
  File.basename(path)
end

- (Object) size



15
16
17
# File 'lib/file_compat.rb', line 15

def size
  File.size(path)
end