Class: Ansible::Ruby::DslBuilders::Base
- Inherits:
-
Object
- Object
- Ansible::Ruby::DslBuilders::Base
show all
- Defined in:
- lib/ansible/ruby/dsl_builders/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
5
6
7
|
# File 'lib/ansible/ruby/dsl_builders/base.rb', line 5
def initialize
@result = nil
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id, *args, &block) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/ansible/ruby/dsl_builders/base.rb', line 21
def method_missing(id, *args, &block)
result = begin
_process_method id, *args, &block
rescue StandardError => our_error
begin
super
rescue NameError => ruby_error
matching_line = ruby_error.backtrace
.map { |str| str.split ':' }
.find { |arr| arr[0] == '(eval)' }[1]
raise "#{our_error.message} at line #{matching_line}!"
end
end
method_missing_return id, result, *args
end
|
Instance Method Details
#_result ⇒ Object
9
10
11
|
# File 'lib/ansible/ruby/dsl_builders/base.rb', line 9
def _result
@result
end
|
#jinja(text) ⇒ Object
17
18
19
|
# File 'lib/ansible/ruby/dsl_builders/base.rb', line 17
def jinja(text)
"{{ #{text} }}"
end
|
#respond_to_missing? ⇒ Boolean
13
14
15
|
# File 'lib/ansible/ruby/dsl_builders/base.rb', line 13
def respond_to_missing?(*)
super
end
|