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

#content_typeObject


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

def content_type
  nil
end

#local_pathObject


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

def local_path
  path
end

#original_filenameObject


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

def original_filename
  File.basename(path)
end

#sizeObject


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

def size
  File.size(path)
end