Sha256: 0f4f92c3756021b8bda24d8d676ebfcacec316e3f20e1a58bc7c7b5b4c995d63

Contents?: true

Size: 545 Bytes

Versions: 3

Compression:

Stored size: 545 Bytes

Contents

class Ppl::Format::AddressBook::MuttQuery < Ppl::Format::AddressBook

  attr_writer :table

  def initialize
    @table = Ppl::Format::Table.new([:email, :name])
    @table.separator = Ppl::Format::Table::SEPARATOR_TABS
  end

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


  private

  def add_row(contact)
    name = nil
    if !contact.name.nil?
      name = contact.name
    end

    @table.add_row({
      :email => contact.email_address,
      :name  => name,
    })
  end


end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ppl-1.3.0 lib/ppl/format/address_book/mutt_query.rb
ppl-1.2.0 lib/ppl/format/address_book/mutt_query.rb
ppl-1.1.0 lib/ppl/format/address_book/mutt_query.rb