Class: NodeMutation::Result
- Inherits:
-
Object
- Object
- NodeMutation::Result
- Defined in:
- lib/node_mutation/result.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#new_source ⇒ Object
Returns the value of attribute new_source.
Instance Method Summary collapse
- #affected? ⇒ Boolean
- #conflicted? ⇒ Boolean
-
#initialize(affected:, conflicted:) ⇒ Result
constructor
A new instance of Result.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(affected:, conflicted:) ⇒ Result
Returns a new instance of Result.
7 8 9 10 11 |
# File 'lib/node_mutation/result.rb', line 7 def initialize(affected:, conflicted:) @affected = affected @conflicted = conflicted @actions = [] end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
4 5 6 |
# File 'lib/node_mutation/result.rb', line 4 def actions @actions end |
#file_path ⇒ Object
Returns the value of attribute file_path.
4 5 6 |
# File 'lib/node_mutation/result.rb', line 4 def file_path @file_path end |
#new_source ⇒ Object
Returns the value of attribute new_source.
4 5 6 |
# File 'lib/node_mutation/result.rb', line 4 def new_source @new_source end |
Instance Method Details
#affected? ⇒ Boolean
13 14 15 |
# File 'lib/node_mutation/result.rb', line 13 def affected? @affected end |
#conflicted? ⇒ Boolean
17 18 19 |
# File 'lib/node_mutation/result.rb', line 17 def conflicted? @conflicted end |
#to_json(*args) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/node_mutation/result.rb', line 21 def to_json(*args) data = { affected: affected?, conflicted: conflicted? } data[:new_source] = new_source if new_source data[:actions] = actions unless actions.empty? data.to_json(*args) end |