Module: Associo::FileHelpers
- Defined in:
- lib/associo/file_helpers.rb
Overview
Syntax helper for accessing file attributes.
Class Method Summary collapse
Class Method Details
.name(file) ⇒ Object
4 5 6 7 8 |
# File 'lib/associo/file_helpers.rb', line 4 def self.name(file) return file.original_filename if file.respond_to?(:original_filename) File.basename(file.path) end |
.size(file) ⇒ Object
10 11 12 |
# File 'lib/associo/file_helpers.rb', line 10 def self.size(file) file.respond_to?(:size) ? file.size : File.size(file) end |
.type(file) ⇒ Object
14 15 16 17 18 |
# File 'lib/associo/file_helpers.rb', line 14 def self.type(file) return file.type if file.is_a? Associo::IO Wand.wave file.path, original_filename: Associo::FileHelpers.name(file) end |