Class: S3Direct::HybridStrategy
- Inherits:
-
Struct
- Object
- Struct
- S3Direct::HybridStrategy
- Defined in:
- lib/s3direct/content_type_detection.rb
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
38 39 40 |
# File 'lib/s3direct/content_type_detection.rb', line 38 def filename @filename end |
#filetype ⇒ Object
Returns the value of attribute filetype
38 39 40 |
# File 'lib/s3direct/content_type_detection.rb', line 38 def filetype @filetype end |
Instance Method Details
#lookup ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/s3direct/content_type_detection.rb', line 39 def lookup types = MIME::Types.type_for(filename) type = if types.length == 1 types.first elsif types.length > 1 media_type = filetype.split('/').first types.detect {|t| t.media_type == media_type} end (type || ContentTypeDetection::Default).content_type end |