Class: Dcc::Diff::Change
- Inherits:
-
Struct
- Object
- Struct
- Dcc::Diff::Change
- Defined in:
- lib/dcc/diff/change.rb
Overview
A single structural change between two DCC object trees.
Instance Attribute Summary collapse
-
#after ⇒ Object
Returns the value of attribute after.
-
#before ⇒ Object
Returns the value of attribute before.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
Instance Attribute Details
#after ⇒ Object
Returns the value of attribute after
6 7 8 |
# File 'lib/dcc/diff/change.rb', line 6 def after @after end |
#before ⇒ Object
Returns the value of attribute before
6 7 8 |
# File 'lib/dcc/diff/change.rb', line 6 def before @before end |
#kind ⇒ Object
Returns the value of attribute kind
6 7 8 |
# File 'lib/dcc/diff/change.rb', line 6 def kind @kind end |
#path ⇒ Object
Returns the value of attribute path
6 7 8 |
# File 'lib/dcc/diff/change.rb', line 6 def path @path end |
Instance Method Details
#added? ⇒ Boolean
7 |
# File 'lib/dcc/diff/change.rb', line 7 def added? = kind == :add |
#changed? ⇒ Boolean
9 |
# File 'lib/dcc/diff/change.rb', line 9 def changed? = kind == :change |
#removed? ⇒ Boolean
8 |
# File 'lib/dcc/diff/change.rb', line 8 def removed? = kind == :remove |
#to_s ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/dcc/diff/change.rb', line 11 def to_s case kind when :add then "+ #{path}: #{after}" when :remove then "- #{path}: #{before}" when :change then "~ #{path}: #{before} -> #{after}" else path end end |