Class: Customer::AddressPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/customer/address_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(address) ⇒ AddressPresenter



3
4
5
# File 'app/presenters/customer/address_presenter.rb', line 3

def initialize(address)
  @address = address
end

Instance Method Details

#to_sObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/presenters/customer/address_presenter.rb', line 7

def to_s
  return nil if address.nil?

  components = [
    address.address1,
    address.address2,
    address.city,
    address.state_text,
    address.zipcode,
    address.country.to_s
  ]

  components.reject(&:blank?)
            .join(', ')
end