class Ppl::Format::Contact::PhoneNumber
Attributes
table[W]
Public Class Methods
new(colors={})
click to toggle source
# File lib/ppl/format/contact/phone_number.rb, line 5 def initialize(colors={}) @table = Ppl::Format::Table.new([:star, :phone_numbers, :type], colors) end
Public Instance Methods
process(contact)
click to toggle source
# File lib/ppl/format/contact/phone_number.rb, line 9 def process(contact) contact.phone_numbers.each { |pn| add_row(pn) } @table.to_s end
Private Instance Methods
add_row(phone_number)
click to toggle source
# File lib/ppl/format/contact/phone_number.rb, line 16 def add_row(phone_number) @table.add_row({ :star => format_star(phone_number), :phone_numbers => phone_number.number, :type => format_type(phone_number.type), }) end
format_star(phone_number)
click to toggle source
# File lib/ppl/format/contact/phone_number.rb, line 24 def format_star(phone_number) phone_number.preferred ? "*" : " " end
format_type(type)
click to toggle source
# File lib/ppl/format/contact/phone_number.rb, line 28 def format_type(type) unless type.nil? || type == "" "(#{type})" end end