Class: Procedure::Outcome
- Inherits:
-
Object
- Object
- Procedure::Outcome
- Defined in:
- lib/procedure/outcome.rb
Instance Method Summary collapse
- #add(step) ⇒ Object
- #failure? ⇒ Boolean
- #failure_code ⇒ Object
- #failure_message ⇒ Object
-
#initialize(step_classes) ⇒ Outcome
constructor
A new instance of Outcome.
- #passed_steps ⇒ Object
- #positive? ⇒ Boolean
Constructor Details
#initialize(step_classes) ⇒ Outcome
3 4 5 6 7 |
# File 'lib/procedure/outcome.rb', line 3 def initialize(step_classes) @step_classes = step_classes @failed_step = nil @passed_steps = [] end |
Instance Method Details
#add(step) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/procedure/outcome.rb', line 9 def add(step) if step.passed? @passed_steps << step else @failed_step = step end end |
#failure? ⇒ Boolean
29 30 31 |
# File 'lib/procedure/outcome.rb', line 29 def failure? !@failed_step.nil? end |
#failure_code ⇒ Object
23 24 25 26 27 |
# File 'lib/procedure/outcome.rb', line 23 def failure_code return unless failure? @failed_step.failure_code end |
#failure_message ⇒ Object
17 18 19 20 21 |
# File 'lib/procedure/outcome.rb', line 17 def return unless failure? @failed_step. end |
#passed_steps ⇒ Object
37 38 39 |
# File 'lib/procedure/outcome.rb', line 37 def passed_steps @passed_steps.map { |step| step.class.name } end |
#positive? ⇒ Boolean
33 34 35 |
# File 'lib/procedure/outcome.rb', line 33 def positive? @failed_step.nil? && @step_classes.size == @passed_steps.size end |