class Statefully::Change
Change
is a tuple of current and previous value of a field in a {Diff}.
Attributes
current[R]
Returns the current {State} field value
@return [Object] current {State} field value @api public @example
Statefully::Change.new(current: 7, previous: 8).current => 7
previous[R]
Returns the previous {State} field value
@return [Object] previous {State} field value @api public @example
Statefully::Change.new(current: 7, previous: 8).previous => 8
Public Class Methods
new(current:, previous:)
click to toggle source
Constructor for the {Change} object @param current [Object] current {State} field value @param previous [Object] previous {State} field value @api public @example
Statefully::Change.new(current: 7, previous: 8) => #<Statefully::Change current=7, previous=8>
# File lib/statefully/change.rb, line 29 def initialize(current:, previous:) @current = current @previous = previous end
Public Instance Methods
inspect()
click to toggle source
Human-readable representation of the {Change} for console inspection
@return [String] @api semipublic @example
Statefully::Change.new(current: 7, previous: 8) => #<Statefully::Change current=7, previous=8>
# File lib/statefully/change.rb, line 47 def inspect "#<#{self.class.name} " \ "#{Inspect.from_fields(current: current, previous: previous)}>" end
none?()
click to toggle source
Internal-only method used to determine whether there was any change @api private
# File lib/statefully/change.rb, line 36 def none? @current == @previous end