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.
32 33 34 |
# File 'lib/mini_mime.rb', line 32 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.
30 31 32 |
# File 'lib/mini_mime.rb', line 30 def content_type @content_type end |
#encoding ⇒ Object
Returns the value of attribute encoding.
30 31 32 |
# File 'lib/mini_mime.rb', line 30 def encoding @encoding end |
#extension ⇒ Object
Returns the value of attribute extension.
30 31 32 |
# File 'lib/mini_mime.rb', line 30 def extension @extension end |
Instance Method Details
#[](idx) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/mini_mime.rb', line 36 def [](idx) if idx == 0 @extension elsif idx == 1 @content_type elsif idx == 2 @encoding end end |
#binary? ⇒ Boolean
46 47 48 |
# File 'lib/mini_mime.rb', line 46 def binary? BINARY_ENCODINGS.include?(encoding) end |