Class: Procedure::Process
- Inherits:
-
Object
- Object
- Procedure::Process
- Defined in:
- lib/procedure/process.rb
Instance Method Summary collapse
- #call ⇒ Object
- #failure? ⇒ Boolean
- #failure_code ⇒ Object
- #failure_message ⇒ Object
-
#initialize(context, steps) ⇒ Process
constructor
A new instance of Process.
- #passed_steps ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(context, steps) ⇒ Process
Returns a new instance of Process.
3 4 5 6 7 |
# File 'lib/procedure/process.rb', line 3 def initialize(context, steps) @context = context @steps = steps @passed = false end |
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/procedure/process.rb', line 29 def call @steps.each do |step_class| step = step_class.new(@context) outcome.add(step) break if outcome.failure? end end |
#failure? ⇒ Boolean
13 14 15 |
# File 'lib/procedure/process.rb', line 13 def failure? !success? end |
#failure_code ⇒ Object
21 22 23 |
# File 'lib/procedure/process.rb', line 21 def failure_code outcome.failure_code end |
#failure_message ⇒ Object
17 18 19 |
# File 'lib/procedure/process.rb', line 17 def outcome. end |
#passed_steps ⇒ Object
25 26 27 |
# File 'lib/procedure/process.rb', line 25 def passed_steps outcome.passed_steps end |
#success? ⇒ Boolean
9 10 11 |
# File 'lib/procedure/process.rb', line 9 def success? outcome.positive? end |