Class: Statefully::Change
- Inherits:
-
Object
- Object
- Statefully::Change
- Defined in:
- lib/statefully/change.rb
Overview
Change is a tuple of current and previous value of a field in a Diff.
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the current State field value.
-
#previous ⇒ Object
readonly
Returns the previous State field value.
Instance Method Summary collapse
-
#initialize(current:, previous:) ⇒ Change
constructor
Constructor for the Change object.
-
#inspect ⇒ String
Human-readable representation of the Change for console inspection.
-
#none? ⇒ Boolean
private
Internal-only method used to determine whether there was any change.
Constructor Details
#initialize(current:, previous:) ⇒ Change
Constructor for the Statefully::Change object
29 30 31 32 |
# File 'lib/statefully/change.rb', line 29 def initialize(current:, previous:) @current = current @previous = previous end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the current State field value
11 12 13 |
# File 'lib/statefully/change.rb', line 11 def current @current end |
#previous ⇒ Object (readonly)
Returns the previous State field value
20 21 22 |
# File 'lib/statefully/change.rb', line 20 def previous @previous end |
Instance Method Details
#inspect ⇒ String
Human-readable representation of the Statefully::Change for console inspection
47 48 49 50 |
# File 'lib/statefully/change.rb', line 47 def inspect "#<#{self.class.name} " \ "#{Inspect.from_fields(current: current, previous: previous)}>" end |
#none? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Internal-only method used to determine whether there was any change
36 37 38 |
# File 'lib/statefully/change.rb', line 36 def none? @current == @previous end |