Class: Uh::WM::Launcher
- Inherits:
-
Object
- Object
- Uh::WM::Launcher
- Defined in:
- lib/uh/wm/launcher.rb
Defined Under Namespace
Classes: DSL
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(actions, rules, run_until) ⇒ Launcher
constructor
A new instance of Launcher.
- #launch(instructions) ⇒ Object
Constructor Details
#initialize(actions, rules, run_until) ⇒ Launcher
Returns a new instance of Launcher.
11 12 13 14 15 |
# File 'lib/uh/wm/launcher.rb', line 11 def initialize actions, rules, run_until @actions = actions @rules = rules @run_until = run_until end |
Class Method Details
.launch(runner, instructions) ⇒ Object
5 6 7 8 |
# File 'lib/uh/wm/launcher.rb', line 5 def launch runner, instructions new(runner.actions, runner.rules, runner.method(:run_until)) .launch instructions end |
Instance Method Details
#launch(instructions) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/uh/wm/launcher.rb', line 17 def launch instructions with_clean_rules do rules = @rules DSL.new(@actions).evaluate(instructions).each do |m, args, block| if m == :execute! @rules[//] = -> { rules.clear } @actions.execute *args, &block @run_until.call { @rules.empty? } else @actions.send m, *args, &block end end end end |