Class: S3Direct::ContentTypeDetection
- Inherits:
-
Struct
- Object
- Struct
- S3Direct::ContentTypeDetection
- Defined in:
- lib/s3direct/content_type_detection.rb
Defined Under Namespace
Classes: Default
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#filetype ⇒ Object
Returns the value of attribute filetype.
Instance Method Summary collapse
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename
4 5 6 |
# File 'lib/s3direct/content_type_detection.rb', line 4 def filename @filename end |
#filetype ⇒ Object
Returns the value of attribute filetype
4 5 6 |
# File 'lib/s3direct/content_type_detection.rb', line 4 def filetype @filetype end |
Instance Method Details
#lookup ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/s3direct/content_type_detection.rb', line 11 def lookup value = if filetype.to_s.empty? FilenameStrategy.new(filename).lookup else HybridStrategy.new(filename, filetype).lookup end remap(value) end |
#remap(value) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/s3direct/content_type_detection.rb', line 21 def remap(value) mappings = { "application/mp4" => "video/mp4", "audio/mp3" => "audio/mpeg" } mappings.fetch(value, value) end |