Class: Ppl::Format::AddressBook::Ages
- Inherits:
-
Ppl::Format::AddressBook
- Object
- Ppl::Format::AddressBook
- Ppl::Format::AddressBook::Ages
- Defined in:
- lib/ppl/format/address_book/ages.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
writeonly
Sets the attribute date.
-
#table ⇒ Object
writeonly
Sets the attribute table.
Instance Method Summary collapse
-
#initialize(colors = {}) ⇒ Ages
constructor
A new instance of Ages.
- #process(address_book) ⇒ Object
Constructor Details
#initialize(colors = {}) ⇒ Ages
Returns a new instance of Ages.
7 8 9 10 |
# File 'lib/ppl/format/address_book/ages.rb', line 7 def initialize(colors={}) @table = Ppl::Format::Table.new([:id, :age], colors) @date = Date.today end |
Instance Attribute Details
#date=(value) ⇒ Object (writeonly)
Sets the attribute date
5 6 7 |
# File 'lib/ppl/format/address_book/ages.rb', line 5 def date=(value) @date = value end |
#table=(value) ⇒ Object (writeonly)
Sets the attribute table
4 5 6 |
# File 'lib/ppl/format/address_book/ages.rb', line 4 def table=(value) @table = value end |
Instance Method Details
#process(address_book) ⇒ Object
12 13 14 15 |
# File 'lib/ppl/format/address_book/ages.rb', line 12 def process(address_book) address_book.contacts.each { |contact| add_row(contact) } @table.to_s end |