Sha256: 0999be4fda58d482c4c4bec5cb631f7f2f9247d643d979ef9c1aceb72023d3b5

Contents?: true

Size: 475 Bytes

Versions: 4

Compression:

Stored size: 475 Bytes

Contents

class Ppl::Format::AddressBook::Ages < Ppl::Format::AddressBook

  attr_writer :table
  attr_writer :date

  def initialize
    @table = Ppl::Format::Table.new([:id, :age])
    @date  = Date.today
  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),
      :age => contact.age(@date).to_s,
    })
  end


end

Version data entries

4 entries across 4 versions & 1 rubygems

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