Sha256: b4eedb6a15057cf5e7ca5d4b6270b54d3882259805a634ee2cab3a32206e4b29

Contents?: true

Size: 489 Bytes

Versions: 1

Compression:

Stored size: 489 Bytes

Contents

module Associo
  # Syntax helper for accessing file attributes.
  module FileHelpers
    def self.name(file)
      return file.original_filename if file.respond_to?(:original_filename)

      File.basename(file.path)
    end

    def self.size(file)
      file.respond_to?(:size) ? file.size : File.size(file)
    end

    def self.type(file)
      return file.type if file.is_a? Associo::IO

      Wand.wave file.path, original_filename: Associo::FileHelpers.name(file)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
associo-0.1.0 lib/associo/file_helpers.rb