Class: Statefully::Diff
- Inherits:
-
Object
- Object
- Statefully::Diff
- Defined in:
- lib/statefully/diff.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#added ⇒ Object
readonly
Returns the value of attribute added.
-
#changed ⇒ Object
readonly
Returns the value of attribute changed.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#added ⇒ Object (readonly)
Returns the value of attribute added.
6 7 8 |
# File 'lib/statefully/diff.rb', line 6 def added @added end |
#changed ⇒ Object (readonly)
Returns the value of attribute changed.
6 7 8 |
# File 'lib/statefully/diff.rb', line 6 def changed @changed end |
Class Method Details
.create(current, previous) ⇒ Object
8 9 10 11 |
# File 'lib/statefully/diff.rb', line 8 def self.create(current, previous) changes = Builder.new(current, previous).build changes.empty? ? None.instance : new(**changes).freeze end |
Instance Method Details
#added?(key) ⇒ Boolean
21 22 23 |
# File 'lib/statefully/diff.rb', line 21 def added?(key) added.key?(key) end |
#changed?(key) ⇒ Boolean
25 26 27 |
# File 'lib/statefully/diff.rb', line 25 def changed?(key) changed.key?(key) end |
#empty? ⇒ Boolean
13 14 15 |
# File 'lib/statefully/diff.rb', line 13 def empty? false end |
#inspect ⇒ Object
17 18 19 |
# File 'lib/statefully/diff.rb', line 17 def inspect "<#{self.class.name} #{inspect_details}>" end |