Class: Arrow::PathExtension
- Inherits:
-
Object
- Object
- Arrow::PathExtension
- Defined in:
- lib/arrow/path-extension.rb
Instance Method Summary collapse
- #extract ⇒ Object
-
#initialize(path) ⇒ PathExtension
constructor
A new instance of PathExtension.
Constructor Details
#initialize(path) ⇒ PathExtension
Returns a new instance of PathExtension.
20 21 22 |
# File 'lib/arrow/path-extension.rb', line 20 def initialize(path) @path = path end |
Instance Method Details
#extract ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/arrow/path-extension.rb', line 24 def extract basename = ::File.basename(@path) components = basename.split(".") return {} if components.size < 2 extension = components.last.downcase if components.size > 2 compression = CompressionType.resolve_extension(extension) if compression { format: components[-2].downcase, compression: compression, } else {format: extension} end else {format: extension} end end |