Class: Mycrm::CoreExt::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/mycrm/core_ext/address.rb

Constant Summary collapse

FIELDS =
[:formatted, :street, :suburb, :state, :postcode, :country]

Instance Method Summary collapse

Constructor Details

#initialize(formatted, locale = :en_au) ⇒ Address

Returns a new instance of Address.



10
11
12
13
# File 'lib/mycrm/core_ext/address.rb', line 10

def initialize(formatted, locale = :en_au)
  @formatted = formatted
  expand(locale)
end

Instance Method Details

#to_hObject



15
16
17
# File 'lib/mycrm/core_ext/address.rb', line 15

def to_h
  FIELDS.reject{ |f| f == :formatted }.each_with_object({}){ |f, out| out[f] = send(f) }
end