Class: Ansible::Ruby::DslBuilders::Tasks

Inherits:
Base
  • Object
show all
Defined in:
lib/ansible/ruby/dsl_builders/tasks.rb

Direct Known Subclasses

Play

Instance Attribute Summary

Attributes inherited from Base

#result

Instance Method Summary collapse

Methods inherited from Base

#method_missing, #respond_to_missing?

Constructor Details

#initializeTasks

Returns a new instance of Tasks.



8
9
10
# File 'lib/ansible/ruby/dsl_builders/tasks.rb', line 8

def initialize
  @tasks = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ansible::Ruby::DslBuilders::Base

Instance Method Details

#evaluateObject



17
18
19
20
# File 'lib/ansible/ruby/dsl_builders/tasks.rb', line 17

def evaluate(*)
  super
  Models::Tasks.new tasks: @tasks
end

#process_method(id) ⇒ Object



22
23
24
# File 'lib/ansible/ruby/dsl_builders/tasks.rb', line 22

def process_method(id, *)
  raise "undefined local variable or method `#{id}'"
end

#task(name, &block) ⇒ Object



12
13
14
15
# File 'lib/ansible/ruby/dsl_builders/tasks.rb', line 12

def task(name, &block)
  task_builder = Task.new name
  @tasks << task_builder.evaluate(&block)
end