Sha256: ef1356781c5aac2d79f86a99c14c13bf29f9c0cc8f3eb3160d4673bec5c647d2

Contents?: true

Size: 937 Bytes

Versions: 11

Compression:

Stored size: 937 Bytes

Contents

class Ppl::Format::Custom::Contact < Ppl::Format::Custom

  format :n do |anything|
    "\n"
  end

  format :i do |contact|
    contact.id
  end

  format :N do |contact|
    contact.name
  end

  format :a do |contact|
    contact.age(Date.today)
  end

  format :b do |contact|
    unless contact.birthday.nil?
      contact.birthday.strftime("%Y-%m-%d")
    end
  end

  format :k do |contact|
    contact.nicknames.first
  end

  format :e do |contact|
    if !contact.preferred_email_address.nil?
      contact.preferred_email_address.address
    elsif !contact.email_addresses.first.nil?
      contact.email_addresses.first.address
    end
  end

  format :o do |contact|
    contact.organizations.first
  end

  format :p do |contact|
    if !contact.preferred_phone_number.nil?
      contact.preferred_phone_number.number
    elsif !contact.phone_numbers.first.nil?
      contact.phone_numbers.first.number
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ppl-3.0.1 lib/ppl/format/custom/contact.rb
ppl-3.0.0 lib/ppl/format/custom/contact.rb
ppl-2.4.1 lib/ppl/format/custom/contact.rb
ppl-2.4.0 lib/ppl/format/custom/contact.rb
ppl-2.3.3 lib/ppl/format/custom/contact.rb
ppl-2.3.2 lib/ppl/format/custom/contact.rb
ppl-2.3.1 lib/ppl/format/custom/contact.rb
ppl-2.3.0 lib/ppl/format/custom/contact.rb
ppl-2.2.0 lib/ppl/format/custom/contact.rb
ppl-2.1.0 lib/ppl/format/custom/contact.rb
ppl-2.0.0 lib/ppl/format/custom/contact.rb