Sha256: 1546cfb0e0f1ff10c1309348f541c566d25c574d87c0a8887f5909901f54de52

Contents?: true

Size: 716 Bytes

Versions: 8

Compression:

Stored size: 716 Bytes

Contents

require_dependency "renalware"

module Renalware
  class AddressPresenter < DumbDelegator
    def to_s
      return "" unless __getobj__.present?

      presentable_attrs
        .map(&:to_s)
        .reject(&:blank?)
        .join(join_arg)
    end

    def country
      CountryPresenter.new(super)
    end

    def to_a
      return [] unless __getobj__.present?

      presentable_attrs
        .map(&:to_s)
        .reject(&:blank?)
    end

    private

    def join_arg
      ", "
    end

    def presentable_attrs
      [
        name,
        organisation_name,
        street_1,
        street_2,
        street_3,
        town,
        county,
        postcode,
        country
      ]
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta11 app/presenters/renalware/address_presenter.rb
renalware-core-2.0.0.pre.beta10 app/presenters/renalware/address_presenter.rb
renalware-core-2.0.0.pre.beta9 app/presenters/renalware/address_presenter.rb
renalware-core-2.0.0.pre.beta8 app/presenters/renalware/address_presenter.rb
renalware-core-2.0.0.pre.beta7 app/presenters/renalware/address_presenter.rb
renalware-core-2.0.0.pre.beta6 app/presenters/renalware/address_presenter.rb
renalware-core-2.0.0.pre.beta5 app/presenters/renalware/address_presenter.rb
renalware-core-2.0.0.pre.beta4 app/presenters/renalware/address_presenter.rb