Class: Dramaturg::Runner::Base
- Inherits:
-
Object
- Object
- Dramaturg::Runner::Base
- Defined in:
- lib/dramaturg/runner/base.rb
Instance Method Summary collapse
- #call(cmd) ⇒ Object
- #handle_fail(cmd) ⇒ Object
-
#initialize(script, config = {}) ⇒ Base
constructor
A new instance of Base.
- #last_success? ⇒ Boolean
Constructor Details
#initialize(script, config = {}) ⇒ Base
Returns a new instance of Base.
3 4 5 6 |
# File 'lib/dramaturg/runner/base.rb', line 3 def initialize(script,config={}) @script = script @last_success = true end |
Instance Method Details
#call(cmd) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dramaturg/runner/base.rb', line 8 def call(cmd) unless cmd.skipped? line = cmd.map { |v| v.for_run }.join('') cmd.ran = line _call(line, cmd) if !cmd.ok? && !cmd.fail_ok handle_fail(cmd) end end @last_success = (cmd.success? && !cmd.skipped?) end |
#handle_fail(cmd) ⇒ Object
28 29 30 |
# File 'lib/dramaturg/runner/base.rb', line 28 def handle_fail(cmd) raise RuntimeError, "#{cmd.ran} failed" end |
#last_success? ⇒ Boolean
23 24 25 |
# File 'lib/dramaturg/runner/base.rb', line 23 def last_success? @last_success end |