Class: Location::AddressPersister
- Inherits:
-
Object
- Object
- Location::AddressPersister
- Defined in:
- app/models/location/address_persister.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#normalizer ⇒ Object
readonly
Returns the value of attribute normalizer.
Instance Method Summary collapse
-
#initialize(normalizer, address) ⇒ AddressPersister
constructor
A new instance of AddressPersister.
- #persist! ⇒ Object
Constructor Details
#initialize(normalizer, address) ⇒ AddressPersister
Returns a new instance of AddressPersister.
5 6 7 8 |
# File 'app/models/location/address_persister.rb', line 5 def initialize(normalizer, address) @normalizer = normalizer @address = address end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
3 4 5 |
# File 'app/models/location/address_persister.rb', line 3 def address @address end |
#normalizer ⇒ Object (readonly)
Returns the value of attribute normalizer.
3 4 5 |
# File 'app/models/location/address_persister.rb', line 3 def normalizer @normalizer end |
Instance Method Details
#persist! ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/models/location/address_persister.rb', line 10 def persist! State.transaction(requires_new: true) do if @address && @address.persisted? update else create end end end |