Sha256: 1f81908433ce45b8c7f15d4f1a84632ac4418f9f495adab2bb4e08104e5adf4b
Contents?: true
Size: 605 Bytes
Versions: 11
Compression:
Stored size: 605 Bytes
Contents
class Ppl::Format::AddressBook::PostalAddresses < Ppl::Format::AddressBook attr_writer :table def initialize(colors={}) @table = Ppl::Format::Table.new([:id, :address_ids], 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), :address_ids => format_address_ids(contact.postal_addresses), }) end def format_address_ids(postal_addresses) postal_addresses.map { |pa| pa.id }.join(", ") end end
Version data entries
11 entries across 11 versions & 1 rubygems