Sha256: 1bdcc423e7f9cdd36b6ff12a0f1fc91e28dae9435f867b0eb6fd9936cf17c65f

Contents?: true

Size: 649 Bytes

Versions: 13

Compression:

Stored size: 649 Bytes

Contents

class Ppl::Format::AddressBook::MuttQuery < Ppl::Format::AddressBook

  attr_writer :table

  def initialize
    @table = Ppl::Format::Table.new([:email, :name])
    @table.separator = Ppl::Format::Table::SEPARATOR_TABS
  end

  def process(address_book)
    address_book.contacts.each { |contact| add_contact(contact) }
    @table.to_s
  end

  private

  def add_contact(contact)
    contact.email_addresses.each do |email_address|
      add_email_address(email_address, contact.name)
    end
  end

  def add_email_address(email_address, name)
    @table.add_row({
      :email => email_address.address,
      :name  => name,
    })
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ppl-3.0.1 lib/ppl/format/address_book/mutt_query.rb
ppl-3.0.0 lib/ppl/format/address_book/mutt_query.rb
ppl-2.4.1 lib/ppl/format/address_book/mutt_query.rb
ppl-2.4.0 lib/ppl/format/address_book/mutt_query.rb
ppl-2.3.3 lib/ppl/format/address_book/mutt_query.rb
ppl-2.3.2 lib/ppl/format/address_book/mutt_query.rb
ppl-2.3.1 lib/ppl/format/address_book/mutt_query.rb
ppl-2.3.0 lib/ppl/format/address_book/mutt_query.rb
ppl-2.2.0 lib/ppl/format/address_book/mutt_query.rb
ppl-2.1.0 lib/ppl/format/address_book/mutt_query.rb
ppl-2.0.0 lib/ppl/format/address_book/mutt_query.rb
ppl-1.25.0 lib/ppl/format/address_book/mutt_query.rb
ppl-1.24.0 lib/ppl/format/address_book/mutt_query.rb