Sha256: 5c4c170be6bff441d3b1ad27c832b277cd32af55c3207cd22293fe038f5f2088
Contents?: true
Size: 594 Bytes
Versions: 10
Compression:
Stored size: 594 Bytes
Contents
class Ppl::Format::AddressBook::OneLine < Ppl::Format::AddressBook attr_writer :table def initialize @table = Ppl::Format::Table.new([:id, :name, :email]) end def process(address_book) address_book.each { |contact| add_row(contact) } @table.to_s end private def add_row(contact) id = sprintf("%s:", contact.id) name = contact.name email = nil if !contact.email_address.nil? email = sprintf("<%s>", contact.email_address) end @table.add_row({ :id => id, :name => name, :email => email, }) end end
Version data entries
10 entries across 10 versions & 1 rubygems