Class: Synco::Runner
- Inherits:
-
Object
- Object
- Synco::Runner
- Defined in:
- lib/synco/scope.rb
Instance Attribute Summary collapse
-
#scripts ⇒ Object
readonly
Returns the value of attribute scripts.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(*scripts) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(*scripts) ⇒ Runner
Returns a new instance of Runner.
27 28 29 |
# File 'lib/synco/scope.rb', line 27 def initialize(*scripts) @scripts = scripts end |
Instance Attribute Details
#scripts ⇒ Object (readonly)
Returns the value of attribute scripts.
31 32 33 |
# File 'lib/synco/scope.rb', line 31 def scripts @scripts end |
Instance Method Details
#call ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/synco/scope.rb', line 33 def call Console.info(self, "Running scripts...") Process::Group.wait do |group| @scripts.each do |script| Fiber.new do ScriptScope.new(script, group).call end.resume end end rescue => error Console::Event::Failure.for(error).emit(self) raise ensure Console.info(self, "Finished running scripts.") end |