Sha256: 66934b5ed4d73b0ac2dc30620f5cead8e6afdbd6ca762dca6defed6990dc6ad8

Contents?: true

Size: 676 Bytes

Versions: 11

Compression:

Stored size: 676 Bytes

Contents

require 'active_support/core_ext/array'
require 'ostruct'

module Govspeak
  class ContactPresenter
    attr_reader :contact
    delegate :id, :content_id, :title, :recipient, :street_address, :postal_code,
      :locality, :region, :country_code, :country_name, :email, :contact_form_url,
      :comments, :worldwide_organisation_path, to: :contact

    def initialize(contact)
      @contact = OpenStruct.new(contact)
    end

    def contact_numbers
      Array.wrap(contact[:contact_numbers])
    end

    def has_postal_address?
      recipient.present? || street_address.present? || locality.present? ||
        region.present? || postal_code.present?
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
govspeak-5.6.0 lib/govspeak/presenters/contact_presenter.rb
govspeak-5.5.0 lib/govspeak/presenters/contact_presenter.rb
govspeak-5.4.0 lib/govspeak/presenters/contact_presenter.rb
govspeak-5.3.0 lib/govspeak/presenters/contact_presenter.rb
govspeak-5.2.2 lib/govspeak/presenters/contact_presenter.rb
govspeak-5.2.1 lib/govspeak/presenters/contact_presenter.rb
govspeak-5.2.0 lib/govspeak/presenters/contact_presenter.rb
govspeak-5.1.0 lib/govspeak/presenters/contact_presenter.rb
govspeak-5.0.3 lib/govspeak/presenters/contact_presenter.rb
govspeak-5.0.2 lib/govspeak/presenters/contact_presenter.rb
govspeak-5.0.1 lib/govspeak/presenters/contact_presenter.rb