Class: Govspeak::ContactPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/govspeak/presenters/contact_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contact) ⇒ ContactPresenter

Returns a new instance of ContactPresenter.



11
12
13
# File 'lib/govspeak/presenters/contact_presenter.rb', line 11

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

Instance Attribute Details

#contactObject (readonly)

Returns the value of attribute contact.



6
7
8
# File 'lib/govspeak/presenters/contact_presenter.rb', line 6

def contact
  @contact
end

Instance Method Details

#contact_numbersObject



15
16
17
# File 'lib/govspeak/presenters/contact_presenter.rb', line 15

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

#has_postal_address?Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/govspeak/presenters/contact_presenter.rb', line 19

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