Module: Pupper::TrackableAttributes::InstanceMethods
- Defined in:
- lib/pupper/trackable_attributes.rb
Instance Method Summary collapse
- #attributes ⇒ Object
- #new_changes ⇒ Object
- #refresh(**attrs) ⇒ Object
- #reload! ⇒ Object
- #rollback! ⇒ Object
Instance Method Details
#attributes ⇒ Object
13 14 15 |
# File 'lib/pupper/trackable_attributes.rb', line 13 def attributes @attributes ||= {} end |
#new_changes ⇒ Object
17 18 19 |
# File 'lib/pupper/trackable_attributes.rb', line 17 def new_changes changes.transform_values(&:last) end |
#refresh(**attrs) ⇒ Object
29 30 31 32 |
# File 'lib/pupper/trackable_attributes.rb', line 29 def refresh(**attrs) assign_attributes(**attrs) changes_applied end |
#reload! ⇒ Object
21 22 23 |
# File 'lib/pupper/trackable_attributes.rb', line 21 def reload! restore_attributes end |
#rollback! ⇒ Object
25 26 27 |
# File 'lib/pupper/trackable_attributes.rb', line 25 def rollback! restore_attributes end |