Module: Poleica::Typeable

Included in:
Polei
Defined in:
lib/poleica/types/typeable.rb

Overview

Retrieve the mimetype, the extension and the type of a file, it needs a “path” method

Instance Method Summary collapse

Instance Method Details

#file_extensionObject



6
7
8
# File 'lib/poleica/types/typeable.rb', line 6

def file_extension
  @file_extension ||= extract_extension
end

#file_mimetypeObject



10
11
12
# File 'lib/poleica/types/typeable.rb', line 10

def file_mimetype
  @file_mimetype ||= extract_mimetype
end

#file_typeObject



14
15
16
17
18
# File 'lib/poleica/types/typeable.rb', line 14

def file_type
  @file_type ||= (detect_type_with_extension ||
                  detect_type_with_mimetype  ||
                  Types::General).new(path)
end