Module: ActionMailer::PartContainer

Included in:
Base, Part
Defined in:
lib/action_mailer/part_container.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#partsObject (readonly)

Returns the value of attribute parts.



3
4
5
# File 'lib/action_mailer/part_container.rb', line 3

def parts
  @parts
end

Instance Method Details

#attachment(params, &block) ⇒ Object

Add an attachment to a multipart message. This is simply a part with the content-disposition set to “attachment”.



17
18
19
20
21
22
# File 'lib/action_mailer/part_container.rb', line 17

def attachment(params, &block)
  params = { :content_type => params } if String === params
  params = { :disposition => "attachment",
             :transfer_encoding => "base64" }.merge(params)
  part(params, &block)
end

#part(params) {|part| ... } ⇒ Object

Add a part to a multipart message, with the given content-type. The part itself is yielded to the block, so that other properties (charset, body, headers, etc.) can be set on it.

Yields:



8
9
10
11
12
13
# File 'lib/action_mailer/part_container.rb', line 8

def part(params)
  params = {:content_type => params} if String === params
  part = Part.new(params)
  yield part if block_given?
  @parts << part
end