Sha256: ffcf7556df8f080a98104a298b95fe6d135002a182a4facf0cfae5c75e96221d

Contents?: true

Size: 562 Bytes

Versions: 9

Compression:

Stored size: 562 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.contacts.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_addresses.first,
      :name  => name,
    })
  end


end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ppl-1.15.1 lib/ppl/format/address_book/mutt_query.rb
ppl-1.15.0 lib/ppl/format/address_book/mutt_query.rb
ppl-1.14.1 lib/ppl/format/address_book/mutt_query.rb
ppl-1.14.0 lib/ppl/format/address_book/mutt_query.rb
ppl-1.13.0 lib/ppl/format/address_book/mutt_query.rb
ppl-1.12.0 lib/ppl/format/address_book/mutt_query.rb
ppl-1.11.0 lib/ppl/format/address_book/mutt_query.rb
ppl-1.10.0 lib/ppl/format/address_book/mutt_query.rb
ppl-1.9.0 lib/ppl/format/address_book/mutt_query.rb