Class: MIME::CompositeMedia::Body

Inherits:
Object
  • Object
show all
Defined in:
lib/mime/composite_media.rb

Instance Method Summary collapse

Constructor Details

#initialize(boundary) ⇒ Body

Create new composite body.



22
23
24
25
# File 'lib/mime/composite_media.rb', line 22

def initialize boundary
  @boundary = boundary
  @body = Array.new
end

Instance Method Details

#add(entity) ⇒ Object

Add entity to the composite body.



38
39
40
# File 'lib/mime/composite_media.rb', line 38

def add entity
  @body.push(entity)
end

#to_sObject

Format the CompositeMedia object as a MIME message.



30
31
32
33
# File 'lib/mime/composite_media.rb', line 30

def to_s
  all_entities = @body.join("\r\n--#{@boundary}\r\n")
  "--#{@boundary}\r\n#{all_entities}\r\n--#{@boundary}--\r\n"
end