Class: MIME::HeaderContainer
- Inherits:
-
Object
- Object
- MIME::HeaderContainer
- Defined in:
- lib/mime/header_container.rb
Overview
Storage for RFC 2822 headers.
Instance Method Summary collapse
-
#add(name, value) ⇒ Object
Add the
name
/value
pair to the header container. -
#initialize ⇒ HeaderContainer
constructor
Return a new header container object.
-
#to_s ⇒ Object
Convert all headers to their string equivalents and join them using the RFC 2822 CRLF line separator.
Constructor Details
#initialize ⇒ HeaderContainer
Return a new header container object.
11 12 13 |
# File 'lib/mime/header_container.rb', line 11 def initialize @headers = Hash.new end |
Instance Method Details
#add(name, value) ⇒ Object
Add the name
/value
pair to the header container.
26 27 28 |
# File 'lib/mime/header_container.rb', line 26 def add name, value @headers.store(name, value) end |
#to_s ⇒ Object
Convert all headers to their string equivalents and join them using the RFC 2822 CRLF line separator.
19 20 21 |
# File 'lib/mime/header_container.rb', line 19 def to_s @headers.to_a.map {|kv| kv.join(": ")}.join("\r\n") end |