Class: MiniMime::Info
- Inherits:
-
Object
- Object
- MiniMime::Info
- Defined in:
- lib/mini_mime.rb
Constant Summary collapse
- BINARY_ENCODINGS =
%w(base64 8bit)
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#encoding ⇒ Object
Returns the value of attribute encoding.
-
#extension ⇒ Object
Returns the value of attribute extension.
Instance Method Summary collapse
- #[](idx) ⇒ Object
- #binary? ⇒ Boolean
-
#initialize(buffer) ⇒ Info
constructor
A new instance of Info.
Constructor Details
#initialize(buffer) ⇒ Info
Returns a new instance of Info.
33 34 35 |
# File 'lib/mini_mime.rb', line 33 def initialize(buffer) @extension, @content_type, @encoding = buffer.split(/\s+/).map!(&:freeze) end |
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
31 32 33 |
# File 'lib/mini_mime.rb', line 31 def content_type @content_type end |
#encoding ⇒ Object
Returns the value of attribute encoding.
31 32 33 |
# File 'lib/mini_mime.rb', line 31 def encoding @encoding end |
#extension ⇒ Object
Returns the value of attribute extension.
31 32 33 |
# File 'lib/mini_mime.rb', line 31 def extension @extension end |
Instance Method Details
#[](idx) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/mini_mime.rb', line 37 def [](idx) if idx == 0 @extension elsif idx == 1 @content_type elsif idx == 2 @encoding end end |
#binary? ⇒ Boolean
47 48 49 |
# File 'lib/mini_mime.rb', line 47 def binary? BINARY_ENCODINGS.include?(encoding) end |