class Ppl::Format::AddressBook::Birthdays
Attributes
table[W]
Public Class Methods
new(colors={})
click to toggle source
# File lib/ppl/format/address_book/birthdays.rb, line 5 def initialize(colors={}) @table = Ppl::Format::Table.new([:id, :birthday], colors) end
Public Instance Methods
process(address_book)
click to toggle source
# File lib/ppl/format/address_book/birthdays.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/birthdays.rb, line 17 def add_row(contact) birthday = nil if !contact.birthday.nil? birthday = contact.birthday.strftime("%Y-%m-%d") end @table.add_row({ :id => sprintf("%s:", contact.id), :birthday => birthday, }) end