Class: Ppl::Format::Contact::Birthday
- Inherits:
-
Ppl::Format::Contact
- Object
- Ppl::Format::Contact
- Ppl::Format::Contact::Birthday
- Defined in:
- lib/ppl/format/contact/birthday.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 = {}) ⇒ Birthday
constructor
A new instance of Birthday.
- #process(contact) ⇒ Object
Constructor Details
Instance Attribute Details
#color_adapter=(value) ⇒ Object (writeonly)
Sets the attribute color_adapter
3 4 5 |
# File 'lib/ppl/format/contact/birthday.rb', line 3 def color_adapter=(value) @color_adapter = value end |
#colors=(value) ⇒ Object (writeonly)
Sets the attribute colors
4 5 6 |
# File 'lib/ppl/format/contact/birthday.rb', line 4 def colors=(value) @colors = value end |
Instance Method Details
#process(contact) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ppl/format/contact/birthday.rb', line 11 def process(contact) output = "" if !contact.birthday.nil? output += contact.birthday.strftime("%Y-%m-%d") end if @colors["birthday"] output = @color_adapter.colorize(output, @colors["birthday"]) end return output end |