Class: Tomo::Configuration::DSL::TasksBlock
- Inherits:
-
Object
- Object
- Tomo::Configuration::DSL::TasksBlock
- Defined in:
- lib/tomo/configuration/dsl/tasks_block.rb
Instance Method Summary collapse
- #batch ⇒ Object
-
#initialize(tasks) ⇒ TasksBlock
constructor
A new instance of TasksBlock.
- #run(task, privileged: false) ⇒ Object
Constructor Details
#initialize(tasks) ⇒ TasksBlock
Returns a new instance of TasksBlock.
7 8 9 |
# File 'lib/tomo/configuration/dsl/tasks_block.rb', line 7 def initialize(tasks) @tasks = tasks end |
Instance Method Details
#batch ⇒ Object
11 12 13 14 15 16 |
# File 'lib/tomo/configuration/dsl/tasks_block.rb', line 11 def batch(&) batch = [] BatchBlock.new(batch).instance_eval(&) @tasks << batch unless batch.empty? self end |
#run(task, privileged: false) ⇒ Object
18 19 20 21 22 |
# File 'lib/tomo/configuration/dsl/tasks_block.rb', line 18 def run(task, privileged: false) task = String.new(task).extend(Runtime::PrivilegedTask) if privileged @tasks << task self end |