Class: MIME::HeaderContainer

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

Overview

Storage for RFC 2822 headers.

Instance Method Summary collapse

Constructor Details

#initializeHeaderContainer

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_sObject

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