Class: UltraMarathon::AbstractRunner
- Inherits:
-
BaseRunner
- Object
- BaseRunner
- UltraMarathon::AbstractRunner
- Defined in:
- lib/ultra_marathon/abstract_runner.rb
Constant Summary
Constants inherited from BaseRunner
BaseRunner::RUN_INSTRUMENTATION_NAME
Instance Attribute Summary
Attributes inherited from BaseRunner
Class Method Summary collapse
-
.run(name = :main, options = {}, &block) ⇒ Object
This is where the magic happens.
- .run_collection(name = :main, items = [], options = {}, &block) ⇒ Object
Methods inherited from BaseRunner
new, #reset, #run!, #run_instrumentation, #success?
Methods included from Contexticution
Methods included from Instrumentation
Methods included from Logging
Class Method Details
.run(name = :main, options = {}, &block) ⇒ Object
This is where the magic happens. Called in the class context, it will be safely executed in the context of the instance.
41 42 43 44 45 46 47 48 49 |
# File 'lib/ultra_marathon/abstract_runner.rb', line 41 def run(name=:main, ={}, &block) name = name.to_sym if !run_blocks.key? name [:name] = name self.run_blocks[name] = [, block] else raise NameError.new("Run block named #{name} already exists!") end end |
.run_collection(name = :main, items = [], options = {}, &block) ⇒ Object
51 52 53 54 |
# File 'lib/ultra_marathon/abstract_runner.rb', line 51 def run_collection(name=:main, items=[], ={}, &block) .merge!(collection: true, items: items) run(name, , &block) end |