Class/Module Index [+]

Quicksearch

Mail::CommonAddress::InstanceMethods

Public Instance Methods

<<(val) click to toggle source
# File lib/mail/fields/common/common_address.rb, line 72
def <<(val)
  case
  when val.nil?
    raise ArgumentError, "Need to pass an address to <<"
  when val.blank?
    parse(encoded)
  else
    parse((formatted + [val]).join(", "))
  end
end
addresses() click to toggle source

Returns the address string of all the addresses in the address list

# File lib/mail/fields/common/common_address.rb, line 26
def addresses
  list = tree.addresses.map { |a| a.address }
  Mail::AddressContainer.new(self, list)
end
addrs() click to toggle source

Returns the actual address objects in the address list

# File lib/mail/fields/common/common_address.rb, line 44
def addrs
  list = tree.addresses
  Mail::AddressContainer.new(self, list)
end
default() click to toggle source
# File lib/mail/fields/common/common_address.rb, line 68
def default
  addresses
end
display_names() click to toggle source

Returns the display name of all the addresses in the address list

# File lib/mail/fields/common/common_address.rb, line 38
def display_names
  list = tree.addresses.map { |a| a.display_name }
  Mail::AddressContainer.new(self, list)
end
each() click to toggle source

Allows you to iterate through each address object in the syntax tree

# File lib/mail/fields/common/common_address.rb, line 19
def each
  tree.addresses.each do |address|
    yield(address)
  end
end
formatted() click to toggle source

Returns the formatted string of all the addresses in the address list

# File lib/mail/fields/common/common_address.rb, line 32
def formatted
  list = tree.addresses.map { |a| a.format }
  Mail::AddressContainer.new(self, list)
end
group_addresses() click to toggle source

Returns the addresses that are part of groups

# File lib/mail/fields/common/common_address.rb, line 59
def group_addresses
  groups.map { |k,v| v.map { |a| a.format } }.flatten
end
groups() click to toggle source

Returns a hash of group name => address strings for the address list

# File lib/mail/fields/common/common_address.rb, line 50
def groups
  @groups = Hash.new
  tree.group_recipients.each do |group|
    @groups[group.group_name.text_value] = get_group_addresses(group.group_list)
  end
  @groups
end
parse(val = value) click to toggle source
# File lib/mail/fields/common/common_address.rb, line 10
def parse(val = value)
  unless val.blank?
    @tree = AddressList.new(val)
  else
    nil
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.