Class: Script::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/script/engine.rb

Instance Method Summary collapse

Constructor Details

#initializeEngine

Returns a new instance of Engine.


2
3
4
5
# File 'lib/script/engine.rb', line 2

def initialize
  @steps = []
  @shareables = {}
end

Instance Method Details

#abort_runObject


25
26
27
28
# File 'lib/script/engine.rb', line 25

def abort_run
  # TODO: Print the result per steps table
  abort
end

#register_step(headline, block) ⇒ Object


11
12
13
# File 'lib/script/engine.rb', line 11

def register_step(headline, block)
  @steps << Script::Step.new(headline, block)
end

#runObject


15
16
17
18
19
20
21
22
23
# File 'lib/script/engine.rb', line 15

def run
  @steps.each do |step|
    puts Script::Output.started(step)
    step.run(@shareables)
    puts Script::Output.result(step)

    abort_run if step.result == :failed
  end
end

#stepsObject


7
8
9
# File 'lib/script/engine.rb', line 7

def steps
  @steps
end