Class: Ansible::Ruby::DslBuilders::Result

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

Instance Method Summary collapse

Constructor Details

#initialize(counter, register_set) ⇒ Result

Returns a new instance of Result.



5
6
7
8
9
10
# File 'lib/ansible/ruby/dsl_builders/result.rb', line 5

def initialize(counter, register_set)
  @name = "result_#{counter}"
  # Until the variable is utilized, we don't know if 'register' should be set, the supplied lambda
  # allows us to set register on the task
  @register_set = register_set
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id, *args) ⇒ Object

we need to respond to everything, don’t want super rubocop:disable Style/MethodMissing



14
15
16
17
18
# File 'lib/ansible/ruby/dsl_builders/result.rb', line 14

def method_missing(id, *args)
  register_needed
  flat_args = args.map(&:inspect).map(&:to_s).join ', '
  "#{@name}.#{id}#{flat_args.empty? ? '' : "(#{flat_args})"}"
end

Instance Method Details

#respond_to_missing?Boolean

rubocop:enable Style/MethodMissing

Returns:

  • (Boolean)


21
22
23
# File 'lib/ansible/ruby/dsl_builders/result.rb', line 21

def respond_to_missing?(*)
  true
end