lib/ppl/format/contact/phone_number.rb in ppl-1.14.1 vs lib/ppl/format/contact/phone_number.rb in ppl-1.15.0

- old
+ new

@@ -1,9 +1,27 @@ class Ppl::Format::Contact::PhoneNumber < Ppl::Format::Contact + attr_writer :color_adapter + attr_writer :colors + + def initialize(colors={}) + @colors = colors + @color_adapter = Ppl::Adapter::Color::Colored.new + end + def process(contact) - contact.phone_numbers.join("\n") + colorize_output(contact.phone_numbers.join("\n")) + end + + private + + def colorize_output(string) + if @colors["phone_numbers"] + @color_adapter.colorize(string, @colors["phone_numbers"]) + else + string + end end end