Class: Ppl::Format::Contact::Age
- Inherits:
-
Ppl::Format::Contact
- Object
- Ppl::Format::Contact
- Ppl::Format::Contact::Age
- Defined in:
- lib/ppl/format/contact/age.rb
Instance Attribute Summary collapse
-
#color_adapter ⇒ Object
writeonly
Sets the attribute color_adapter.
-
#colors ⇒ Object
writeonly
Sets the attribute colors.
Instance Method Summary collapse
-
#initialize(colors = {}) ⇒ Age
constructor
A new instance of Age.
- #process(contact) ⇒ Object
Constructor Details
Instance Attribute Details
#color_adapter=(value) ⇒ Object (writeonly)
Sets the attribute color_adapter
4 5 6 |
# File 'lib/ppl/format/contact/age.rb', line 4 def color_adapter=(value) @color_adapter = value end |
#colors=(value) ⇒ Object (writeonly)
Sets the attribute colors
5 6 7 |
# File 'lib/ppl/format/contact/age.rb', line 5 def colors=(value) @colors = value end |
Instance Method Details
#process(contact) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/ppl/format/contact/age.rb', line 12 def process(contact) age = contact.age(Date.today).to_s if @colors["age"] age = @color_adapter.colorize(age, @colors["age"]) end age end |