Class: Prosereflect::Transform::Step::Result
- Inherits:
-
Object
- Object
- Prosereflect::Transform::Step::Result
- Defined in:
- lib/prosereflect/transform/step.rb
Overview
Result of applying a step
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#failed ⇒ Object
readonly
Returns the value of attribute failed.
Class Method Summary collapse
-
.fail(reason) ⇒ Object
Create a failed result.
-
.ok(doc) ⇒ Object
Create a successful result.
Instance Method Summary collapse
-
#initialize(doc: nil, failed: nil) ⇒ Result
constructor
A new instance of Result.
-
#ok? ⇒ Boolean
Check if the step was successfully applied.
Constructor Details
#initialize(doc: nil, failed: nil) ⇒ Result
Returns a new instance of Result.
67 68 69 70 |
# File 'lib/prosereflect/transform/step.rb', line 67 def initialize(doc: nil, failed: nil) @doc = doc @failed = failed end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
65 66 67 |
# File 'lib/prosereflect/transform/step.rb', line 65 def doc @doc end |
#failed ⇒ Object (readonly)
Returns the value of attribute failed.
65 66 67 |
# File 'lib/prosereflect/transform/step.rb', line 65 def failed @failed end |
Class Method Details
.fail(reason) ⇒ Object
Create a failed result
83 84 85 |
# File 'lib/prosereflect/transform/step.rb', line 83 def self.fail(reason) new(failed: reason) end |
.ok(doc) ⇒ Object
Create a successful result
78 79 80 |
# File 'lib/prosereflect/transform/step.rb', line 78 def self.ok(doc) new(doc: doc) end |
Instance Method Details
#ok? ⇒ Boolean
Check if the step was successfully applied
73 74 75 |
# File 'lib/prosereflect/transform/step.rb', line 73 def ok? !@failed && @doc end |