Class: Puppet::Pops::Lookup::ExplainNode Private
- Defined in:
- lib/puppet/pops/lookup/explainer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The ExplainNode contains information of a specific node in a tree traversed during lookup. The tree can be traversed using the `parent` and `branches` attributes of each node.
Each leaf node contains information about what happened when the leaf of the branch was traversed.
Direct Known Subclasses
Instance Method Summary collapse
- #branches ⇒ Object private
- #dump_on(io, indent, first_indent) ⇒ Object private
- #dump_texts(io, indent) ⇒ Object private
- #explain ⇒ Object private
- #inspect ⇒ Object private
- #text(text) ⇒ Object private
- #to_hash ⇒ Object private
- #to_s ⇒ Object private
Instance Method Details
#branches ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 11 def branches @branches ||= [] end |
#dump_on(io, indent, first_indent) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 42 def dump_on(io, indent, first_indent) dump_texts(io, indent) end |
#dump_texts(io, indent) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 46 def dump_texts(io, indent) @texts.each { |text| io << indent << text << "\n" } if instance_variable_defined?(:@texts) end |
#explain ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 24 25 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 21 def explain io = '' dump_on(io, '', '') io end |
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 27 def inspect to_s end |
#text(text) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 37 def text(text) @texts ||= [] @texts << text end |
#to_hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 18 19 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 15 def to_hash hash = {} hash[:branches] = @branches.map {|b| b.to_hash} unless @branches.nil? || @branches.empty? hash end |
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 35 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 31 def to_s s = self.class.name s = "#{s} with #{@branches.size} branches" unless @branches.nil? s end |