Class: Ansible::Ruby::DslBuilders::Result
- Inherits:
-
Object
- Object
- Ansible::Ruby::DslBuilders::Result
- Defined in:
- lib/ansible/ruby/dsl_builders/result.rb
Instance Method Summary collapse
-
#initialize(counter, register_set) ⇒ Result
constructor
A new instance of Result.
-
#method_missing(id, *args) ⇒ Object
we need to respond to everything, don’t want super rubocop:disable Style/MethodMissing.
-
#respond_to_missing? ⇒ Boolean
rubocop:enable Style/MethodMissing.
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
21 22 23 |
# File 'lib/ansible/ruby/dsl_builders/result.rb', line 21 def respond_to_missing?(*) true end |