Class: Ansible::Ruby::DslBuilders::JinjaItemNode
- Inherits:
-
Object
- Object
- Ansible::Ruby::DslBuilders::JinjaItemNode
- Defined in:
- lib/ansible/ruby/dsl_builders/jinja_item_node.rb
Instance Method Summary collapse
- #+(other) ⇒ Object
-
#initialize(contexts = 'item') ⇒ JinjaItemNode
constructor
A new instance of JinjaItemNode.
-
#method_missing(id) ⇒ Object
we need to respond to everything, don’t want super.
- #to_s ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize(contexts = 'item') ⇒ JinjaItemNode
Returns a new instance of JinjaItemNode.
8 9 10 |
# File 'lib/ansible/ruby/dsl_builders/jinja_item_node.rb', line 8 def initialize(contexts = 'item') @contexts = [*contexts] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id) ⇒ Object
we need to respond to everything, don’t want super
26 27 28 29 |
# File 'lib/ansible/ruby/dsl_builders/jinja_item_node.rb', line 26 def method_missing(id, *) contexts = @contexts + [id] JinjaItemNode.new contexts end |
Instance Method Details
#+(other) ⇒ Object
12 13 14 |
# File 'lib/ansible/ruby/dsl_builders/jinja_item_node.rb', line 12 def +(other) to_s + other.to_s end |
#to_s ⇒ Object
16 17 18 19 |
# File 'lib/ansible/ruby/dsl_builders/jinja_item_node.rb', line 16 def to_s flat = @contexts.join '.' "{{ #{flat} }}" end |
#to_str ⇒ Object
21 22 23 |
# File 'lib/ansible/ruby/dsl_builders/jinja_item_node.rb', line 21 def to_str to_s end |