# Address Classes

## `class TMail::Address`

### Class Methods

`parse(str)` -> `TMail::Address | TMail::AddressGroup`

  str: String

  parses STR and creates new `TMail::Address` object. If STR did not follow the internet address format, `TMail::SyntaxError` exception is raised.

`new(locals, domains)` -> `TMail::Address | TMail::AddressGroup`

  locals: [String]
  domains: [String]

  creates new `TMail::Address` object consist from local part LOCALS and domain part domains.

### Instance Methods

`address_group?` -> `true | false`

  returns false.

`spec` -> `String`

  an address spec ("....@....").

`routes` -> `[String]`

  delivery routes. Strings do not include character "@".

`name` -> `String`
`phrase` -> `String`

  short description for this address (e.g. real name).

`encoded(eol = "\r\n", encoding = 'j')` -> `String`

  eol: String
  encoding: String

  converts this object into MIME-encoded string.

`to_s(eol = "\n", encoding = 'e')` -> `String`
`decoded(eol = "\n", encoding = 'e')` -> `String`

  eol: String
  encoding: String

  converts this object into decoded string.

`==(other)` -> `true | false`

  other: Object

  judge if self equals to other by inspecting addr-spec string (#spec). #name and #routes never affects the return value.

## `class TMail::AddressGroup`

### Class Methods

`new(name, addrs)` -> `TMail::AddressGroup`

  name: String
  addrs: [TMail::Address | TMail::AddressGroup]

  creates new `TMail::AddressGroup` object. NAME is the name of this group, addrs is addresses which belongs to this group.

### Instance Methods

`address_group?` -> `true | false`

  returns true.

`name` -> `String`

  the human readable name of this group.

`addresses` -> `[TMail::Address | TMail::AddressGroup]`

  addresses which belongs to this group.

`to_a` -> `[TMail::Address | TMail::AddressGroup]`
`to_ary` -> `[TMail::Address | TMail::AddressGroup]`

  equals to `addresses.dup`.

`flatten` -> `[TMail::Address]`

  flatten this group into one level of array of `TMail::Address`.

`add(addr)`
`push(addr)`

  addr: TMail::Address | TMail::AddressGroup

  adds an address or an address group to this group.

`delete(addr)`

  addr: TMail::Address | TMail::AddressGroup

  removes ADDR from this group.

`each {|a| .... }`

  a: TMail::Address | TMail::AddressGroup

  equals to `addresses.each {|a| .... }`.

`each_address {|a| .... }`

  a: TMail::Address

  equals to `flatten.each {|a| .... }`

`encoded(eol = "\r\n", encoding = 'j')` -> `String`

  eol: String
  encoding: String

  converts this object into MIME-encoded string.

`decoded(eol = "\n", encoding = 'e')` -> `String`

  eol: String
  encoding: String

  converts this object into decoded string.

`==(other)` -> `true | false`
`eql?(other)` -> `true | false`

  other: Object

  judges if self is equal to OTHER, by comparing `self.addresses` and `other.addresses`. (`self.name` is meanless)