Athena::MIME::Header::Collection
Represents a collection of MIME headers.
Constructors
Class methods
Checks the provided header to ensure its name and type are compatible.
AMIME::Header::Collection.check_header_class AMIME::Header::Date.new("date", Time.utc) # => nil
AMIME::Header::Collection.check_header_class AMIME::Header::Unstructured.new("date", "blah")
# => AMIME::Exception::Logic: The 'date' header must be an instance of 'Athena::MIME::Header::Date' (got 'Athena::MIME::Header::Unstructured').
ameba:disable Metrics/CyclomaticComplexity:
Instance methods
Returns the first header with the provided name casted to type T.
Raises an AMIME::Exception::HeaderNotFound exception if no header with that name exists.
Returns the first header with the provided name.
Raises an AMIME::Exception::HeaderNotFound exception if no header with that name exists.
Returns the first header with the provided name casted to type T, or nil if no headers with that name exist.
Returns the first header with the provided name, or nil if no headers with that name exist.
Adds an AMIME::Header::Date header to the collection with the provided name and body.
Adds an AMIME::Header::Identification header to the collection with the provided name and body.
Adds an AMIME::Header::Mailbox header to the collection with the provided name and body.
Adds an AMIME::Header::MailboxList header to the collection with the provided name and body.
Adds an AMIME::Header::Parameterized header to the collection with the provided name and body.
Adds an AMIME::Header::Path header to the collection with the provided name and body.
Adds an AMIME::Header::Unstructured header to the collection with the provided name and body.
Yields each AMIME::Header::Interface instance stored within the collection with the provided name.
Returns true if the collection contains a header with the provided name, otherwise false.
Returns the value of the provided parameter for the first AMIME::Header::Parameterized header with the provided name.
headers = AMIME::Header::Collection.new
headers.add_parameterized_header "content-type", "text/plain", {"charset" => "UTF-8"}
headers.header_parameter "content-type", "charset" # => "UTF-8"
Returns the string representation of each header in the collection as an array of strings.