Class: Script::Engine
- Inherits:
-
Object
- Object
- Script::Engine
- Defined in:
- lib/script/engine.rb
Instance Method Summary collapse
- #abort_run ⇒ Object
-
#initialize ⇒ Engine
constructor
A new instance of Engine.
- #register_step(headline, block) ⇒ Object
- #run ⇒ Object
- #steps ⇒ Object
Constructor Details
#initialize ⇒ Engine
Returns a new instance of Engine.
2 3 4 |
# File 'lib/script/engine.rb', line 2 def initialize @steps = [] end |
Instance Method Details
#abort_run ⇒ Object
24 25 26 27 |
# File 'lib/script/engine.rb', line 24 def abort_run # TODO: Print the result per steps table abort end |
#register_step(headline, block) ⇒ Object
10 11 12 |
# File 'lib/script/engine.rb', line 10 def register_step(headline, block) @steps << Script::Step.new(headline, block) end |
#run ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/script/engine.rb', line 14 def run @steps.each do |step| puts Script::Output.started(step) step.run puts Script::Output.result(step) abort_run if step.result == :failed end end |
#steps ⇒ Object
6 7 8 |
# File 'lib/script/engine.rb', line 6 def steps @steps end |