class Ppl::Format::AddressBook::MuttQuery

Attributes

table[W]

Public Class Methods

new() click to toggle source
# File lib/ppl/format/address_book/mutt_query.rb, line 5
def initialize
  @table = Ppl::Format::Table.new([:email, :name])
  @table.separator = Ppl::Format::Table::SEPARATOR_TABS
end

Public Instance Methods

process(address_book) click to toggle source
# File lib/ppl/format/address_book/mutt_query.rb, line 10
def process(address_book)
  address_book.contacts.each { |contact| add_contact(contact) }
  @table.to_s
end

Private Instance Methods

add_contact(contact) click to toggle source
# File lib/ppl/format/address_book/mutt_query.rb, line 17
def add_contact(contact)
  contact.email_addresses.each do |email_address|
    add_email_address(email_address, contact.name)
  end
end
add_email_address(email_address, name) click to toggle source
# File lib/ppl/format/address_book/mutt_query.rb, line 23
def add_email_address(email_address, name)
  @table.add_row({
    :email => email_address.address,
    :name  => name,
  })
end