class MIME::Header

Header section for Internet and MIME messages.

Public Class Methods

new() click to toggle source
# File lib/mime/header.rb, line 8
def initialize
  @headers =

Public Instance Methods

delete(name) click to toggle source

Delete header associated with name.

# File lib/mime/header.rb, line 43
def delete name
  @headers.delete_if {|k,v| name.downcase == k.downcase }
get(name) click to toggle source

Get header value associated with name.

# File lib/mime/header.rb, line 26
def get name
  _, value = @headers.find {|k,v| name.downcase == k.downcase }
set(name, value) click to toggle source

Set header name to value. If a header of the same name exists it will be overwritten. Header names are case-insensitive.

# File lib/mime/header.rb, line 35
def set name, value
  delete(name), value) unless value.nil?
to_s() click to toggle source

Convert all headers to their string equivalents and join them using the RFC 2822 CRLF line separator.

# File lib/mime/header.rb, line 19
def to_s {|kv| kv.join(": ")}.join("\r\n")