Sha256: 0f1c0f7a65bd39cea30219eeffe97b3335e711def2d07fd56735fd68ab3cbc9d

Contents?: true

Size: 548 Bytes

Versions: 5

Compression:

Stored size: 548 Bytes

Contents

class Ppl::Format::AddressBook::Birthdays < Ppl::Format::AddressBook

  attr_writer :table

  def initialize
    @table = Ppl::Format::Table.new([:id, :birthday])
  end

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


  private

  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


end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ppl-1.14.1 lib/ppl/format/address_book/birthdays.rb
ppl-1.14.0 lib/ppl/format/address_book/birthdays.rb
ppl-1.13.0 lib/ppl/format/address_book/birthdays.rb
ppl-1.12.0 lib/ppl/format/address_book/birthdays.rb
ppl-1.11.0 lib/ppl/format/address_book/birthdays.rb