Sha256: 079062d6e2f9bd7627e9e7cfe01f183322e982abda10080326f1486be1299231

Contents?: true

Size: 672 Bytes

Versions: 5

Compression:

Stored size: 672 Bytes

Contents

class Ppl::Format::PostalAddress::OneLine < Ppl::Format::AddressBook

  def process(postal_address, table)
    table.add_row({
      :star         => format_star(postal_address),
      :address_id   => postal_address.id,
      :address_text => format_address_text(postal_address),
    })
  end

  private

  def format_star(postal_address)
    postal_address.preferred ? "*" : " "
  end

  def format_address_text(postal_address)
    [
      postal_address.street,
      postal_address.locality,
      postal_address.region,
      postal_address.country,
      postal_address.postal_code,
      postal_address.po_box,
    ].compact.reject(&:empty?).join(", ")
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ppl-4.0.5 lib/ppl/format/postal_address/one_line.rb
ppl-4.0.3 lib/ppl/format/postal_address/one_line.rb
ppl-4.0.2 lib/ppl/format/postal_address/one_line.rb
ppl-4.0.1 lib/ppl/format/postal_address/one_line.rb
ppl-4.0.0 lib/ppl/format/postal_address/one_line.rb