Class: MIME::MediaType
- Inherits:
-
Object
- Object
- MIME::MediaType
- Includes:
- Headers::MIME
- Defined in:
- lib/mime/media_type.rb
Overview
Abstract top-level media type class.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Attributes included from Headers::MIME
#content_description, #content_disposition, #content_id, #content_transfer_encoding, #content_type, #mime_version
Instance Method Summary collapse
-
#initialize(body, content_type) ⇒ MediaType
constructor
A new instance of MediaType.
-
#to_s ⇒ Object
Transform the the MediaType object into a MIME message.
Constructor Details
#initialize(body, content_type) ⇒ MediaType
Returns a new instance of MediaType.
18 19 20 21 22 23 24 25 |
# File 'lib/mime/media_type.rb', line 18 def initialize body, content_type AbstractClassError.no_instantiation(self, MediaType) @headers = HeaderContainer.new @body = body self.content_id = unique_id self.content_type = content_type end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
14 15 16 |
# File 'lib/mime/media_type.rb', line 14 def headers @headers end |
Instance Method Details
#to_s ⇒ Object
Transform the the MediaType object into a MIME message.
30 31 32 |
# File 'lib/mime/media_type.rb', line 30 def to_s "#{headers}\r\n\r\n#{body}" end |