Class: RMail::Address::Parser

Class RMail::Address::Parser |
In: | lib/rmail/address.rb
Parent: | Object

This class provides a facility to parse a string containing one or more RFC2822 addresses into an array of RMail::Address objects. You can use it directly, but it is more conveniently used with the RMail::Address.parse method.

Methods

new parse

Public Class methods

new(string)

Create a RMail::Address::Parser object that will parse `string`. See also the RMail::Address.parse method.

Public Instance methods

parse()

This function attempts to extract mailing addresses from the string passed to #new. The function returns an RMail::Address::List of RMail::Address objects (RMail::Address::List is a subclass of Array). A malformed input string will not generate an exception. Instead, the array returned will simply not contained the malformed addresses.

The string is expected to be in a valid format as documented in RFC2822’s mailbox-list grammar. This will work for lists of addresses in the `To:`, `From:`, etc. headers in email.