Class: Tomo::Configuration::DSL::TasksBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/tomo/configuration/dsl/tasks_block.rb

Instance Method Summary collapse

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

#batchObject



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