Sha256: b02f543a3e60ff01881129b057cef68e1a6f9168515e2e3cc3dd3c565be19db2

Contents?: true

Size: 758 Bytes

Versions: 40

Compression:

Stored size: 758 Bytes

Contents

class Ppl::Format::Contact::PostalAddress < Ppl::Format::Contact

  attr_writer :table

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

  def process(contact)
    address = contact.postal_address

    if !address.nil?
      {
        :street      => "Street",
        :postal_code => "Postal Code",
        :po_box      => "PO box",
        :locality    => "Locality",
        :region      => "Region",
        :country     => "Country",
      }.each do |property, name|
        value = address.send(property)
        next if value.nil? || value == ""
        @table.add_row({
          :label => sprintf("%s:", name),
          :value => address.send(property)
        })
      end
    end

    return @table.to_s
  end

end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
ppl-3.0.1 lib/ppl/format/contact/postal_address.rb
ppl-3.0.0 lib/ppl/format/contact/postal_address.rb
ppl-2.4.1 lib/ppl/format/contact/postal_address.rb
ppl-2.4.0 lib/ppl/format/contact/postal_address.rb
ppl-2.3.3 lib/ppl/format/contact/postal_address.rb
ppl-2.3.2 lib/ppl/format/contact/postal_address.rb
ppl-2.3.1 lib/ppl/format/contact/postal_address.rb
ppl-2.3.0 lib/ppl/format/contact/postal_address.rb
ppl-2.2.0 lib/ppl/format/contact/postal_address.rb
ppl-2.1.0 lib/ppl/format/contact/postal_address.rb
ppl-2.0.0 lib/ppl/format/contact/postal_address.rb
ppl-1.25.0 lib/ppl/format/contact/postal_address.rb
ppl-1.24.0 lib/ppl/format/contact/postal_address.rb
ppl-1.23.0 lib/ppl/format/contact/postal_address.rb
ppl-1.22.2 lib/ppl/format/contact/postal_address.rb
ppl-1.22.1 lib/ppl/format/contact/postal_address.rb
ppl-1.22.0 lib/ppl/format/contact/postal_address.rb
ppl-1.21.0 lib/ppl/format/contact/postal_address.rb
ppl-1.20.0 lib/ppl/format/contact/postal_address.rb
ppl-1.19.0 lib/ppl/format/contact/postal_address.rb