class Ppl::Format::AddressBook::Names
Attributes
table[W]
Public Class Methods
new(colors={})
click to toggle source
# File lib/ppl/format/address_book/names.rb, line 5 def initialize(colors={}) @table = Ppl::Format::Table.new([:id, :name], colors) end
Public Instance Methods
process(address_book)
click to toggle source
# File lib/ppl/format/address_book/names.rb, line 9 def process(address_book) address_book.contacts.each { |contact| add_row(contact) } @table.to_s end
Private Instance Methods
add_row(contact)
click to toggle source
# File lib/ppl/format/address_book/names.rb, line 17 def add_row(contact) id = sprintf("%s:", contact.id) name = nil if !contact.name.nil? name = contact.name end @table.add_row({ :id => id, :name => name, }) end