class Puppet::Pops::Lookup::ExplainNode

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.

Public Instance Methods

branches() click to toggle source
   # File lib/puppet/pops/lookup/explainer.rb
12 def branches
13   @branches ||= []
14 end
dump_on(io, indent, first_indent) click to toggle source
   # File lib/puppet/pops/lookup/explainer.rb
43 def dump_on(io, indent, first_indent)
44   dump_texts(io, indent)
45 end
dump_texts(io, indent) click to toggle source
   # File lib/puppet/pops/lookup/explainer.rb
47 def dump_texts(io, indent)
48   @texts.each { |text| io << indent << text << "\n" } if instance_variable_defined?(:@texts)
49 end
explain() click to toggle source
   # File lib/puppet/pops/lookup/explainer.rb
22 def explain
23   io = String.new
24   dump_on(io, '', '')
25   io
26 end
inspect() click to toggle source
   # File lib/puppet/pops/lookup/explainer.rb
28 def inspect
29   to_s
30 end
text(text) click to toggle source
   # File lib/puppet/pops/lookup/explainer.rb
38 def text(text)
39   @texts ||= []
40   @texts << text
41 end
to_hash() click to toggle source
   # File lib/puppet/pops/lookup/explainer.rb
16 def to_hash
17   hash = {}
18   hash[:branches] = @branches.map {|b| b.to_hash} unless @branches.nil? || @branches.empty?
19   hash
20 end
to_s() click to toggle source
   # File lib/puppet/pops/lookup/explainer.rb
32 def to_s
33   s = self.class.name
34   s = "#{s} with #{@branches.size} branches" unless @branches.nil?
35   s
36 end