Class: MIME::MultipartMedia
- Inherits:
-
CompositeMediaType
- Object
- MediaType
- CompositeMediaType
- MIME::MultipartMedia
- Defined in:
- lib/mime/composite_media_type.rb
Overview
The abstract base class for all multipart message subtypes. The entities of a multipart message are delimited by a unique boundary.
Direct Known Subclasses
Defined Under Namespace
Classes: Alternative, FormData, Mixed, Related
Instance Attribute Summary
Attributes inherited from MediaType
Attributes included from Headers::MIME
#content_description, #content_disposition, #content_id, #content_transfer_encoding, #content_type, #mime_version
Instance Method Summary collapse
-
#body ⇒ Object
Return the multipart representation of the body.
-
#boundary ⇒ Object
The boundary used to separate the message entities.
-
#initialize(content_type) ⇒ MultipartMedia
constructor
A new instance of MultipartMedia.
Methods inherited from CompositeMediaType
#add_entity, #attach_entity, #inline_entity
Methods inherited from MediaType
Constructor Details
#initialize(content_type) ⇒ MultipartMedia
Returns a new instance of MultipartMedia.
61 62 63 64 |
# File 'lib/mime/composite_media_type.rb', line 61 def initialize content_type AbstractClassError.no_instantiation(self, MultipartMedia) super end |
Instance Method Details
#body ⇒ Object
Return the multipart representation of the body.
76 77 78 79 |
# File 'lib/mime/composite_media_type.rb', line 76 def body all_entities = @entities.join("\r\n--#{boundary}\r\n") "--#{boundary}\r\n#{all_entities}\r\n--#{boundary}--\r\n" end |
#boundary ⇒ Object
The boundary used to separate the message entities.
69 70 71 |
# File 'lib/mime/composite_media_type.rb', line 69 def boundary @boundary ||= "Boundary_#{unique_id}" end |