Sha256: 510a3460864d9f14f9df061a17358a3e1ffba4691047130000afc8834134582f

Contents?: true

Size: 633 Bytes

Versions: 13

Compression:

Stored size: 633 Bytes

Contents

class Ppl::Format::AddressBook::EmailAddresses < Ppl::Format::AddressBook

  attr_writer :table

  def initialize(colors={})
    @table = Ppl::Format::Table.new([:id, :email_addresses], colors)
  end

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


  private

  def add_row(contact)
    @table.add_row({
      :id              => sprintf("%s:", contact.id),
      :email_addresses => stringify_email_addresses(contact.email_addresses),
    })
  end

  def stringify_email_addresses(email_addresses)
    email_addresses.map { |em| em.address }.join(", ")
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

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