Class: MIME::Media
Overview
Abstract top-level media class.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Attributes included from Headers::MIME
#description, #disposition, #id, #mime_version, #transfer_encoding, #type
Instance Method Summary collapse
-
#initialize(content, content_type, content_params = {}) ⇒ Media
constructor
A new instance of Media.
-
#to_s ⇒ Object
Format the Media object as a MIME message.
Constructor Details
#initialize(content, content_type, content_params = {}) ⇒ Media
Returns a new instance of Media.
14 15 16 17 18 19 20 |
# File 'lib/mime/media.rb', line 14 def initialize content, content_type, content_params = {} AbstractClassError.no_instantiation(self, Media) @headers = Header.new @body = content self.id = ID.generate_gid self.type = append_field_params(content_type, content_params) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
12 13 14 |
# File 'lib/mime/media.rb', line 12 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
12 13 14 |
# File 'lib/mime/media.rb', line 12 def headers @headers end |
Instance Method Details
#to_s ⇒ Object
Format the Media object as a MIME message.
25 26 27 |
# File 'lib/mime/media.rb', line 25 def to_s "#{headers}\r\n\r\n#{body}" end |