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 11 def branches 12 @branches ||= [] 13 end
dump_on(io, indent, first_indent)
click to toggle source
# File lib/puppet/pops/lookup/explainer.rb 42 def dump_on(io, indent, first_indent) 43 dump_texts(io, indent) 44 end
dump_texts(io, indent)
click to toggle source
# File lib/puppet/pops/lookup/explainer.rb 46 def dump_texts(io, indent) 47 @texts.each { |text| io << indent << text << "\n" } if instance_variable_defined?(:@texts) 48 end
explain()
click to toggle source
# File lib/puppet/pops/lookup/explainer.rb 21 def explain 22 io = '' 23 dump_on(io, '', '') 24 io 25 end
inspect()
click to toggle source
# File lib/puppet/pops/lookup/explainer.rb 27 def inspect 28 to_s 29 end
text(text)
click to toggle source
# File lib/puppet/pops/lookup/explainer.rb 37 def text(text) 38 @texts ||= [] 39 @texts << text 40 end
to_hash()
click to toggle source
# File lib/puppet/pops/lookup/explainer.rb 15 def to_hash 16 hash = {} 17 hash[:branches] = @branches.map {|b| b.to_hash} unless @branches.nil? || @branches.empty? 18 hash 19 end
to_s()
click to toggle source
# File lib/puppet/pops/lookup/explainer.rb 31 def to_s 32 s = self.class.name 33 s = "#{s} with #{@branches.size} branches" unless @branches.nil? 34 s 35 end