Sha256: 197de6de5be3987bdf075df1f25087079022e34a55309f16601ca96c96e3f14e

Contents?: true

Size: 585 Bytes

Versions: 18

Compression:

Stored size: 585 Bytes

Contents

class Ppl::Format::AddressBook::PhoneNumbers < Ppl::Format::AddressBook

  attr_writer :table

  def initialize
    @table = Ppl::Format::Table.new([:id, :phone_number])
  end

  def process(address_book)
    address_book.each { |contact| add_row(contact) }
    @table.to_s
  end


  private

  def add_row(contact)
    contact_id   = sprintf("%s:", contact.id)
    phone_number = nil

    if !contact.phone_number.nil?
      phone_number = contact.phone_number
    end

    @table.add_row({
      :id           => contact_id,
      :phone_number => phone_number,
    })
  end


end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ppl-1.8.0 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.7.0 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.6.0 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.5.3 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.5.2 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.5.1 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.5.0 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.4.1 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.3.0 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.2.0 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.1.0 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.0.6 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.0.5 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.0.4 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.0.3 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.0.1 lib/ppl/format/address_book/phone_numbers.rb
ppl-1.0.0 lib/ppl/format/address_book/phone_numbers.rb
ppl-0.9.0 lib/ppl/format/address_book/phone_numbers.rb