Class: Puppet::Pops::Lookup::ExplainNode

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/pops/lookup/explainer.rb

Overview

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

ExplainMergeSource, ExplainTreeNode, Explainer

Instance Method Summary collapse

Instance Method Details

#branchesObject



10
11
12
# File 'lib/puppet/pops/lookup/explainer.rb', line 10

def branches
  @branches ||= []
end

#dump_on(io, indent, first_indent) ⇒ Object



26
27
# File 'lib/puppet/pops/lookup/explainer.rb', line 26

def dump_on(io, indent, first_indent)
end

#to_hashObject



14
15
16
17
18
# File 'lib/puppet/pops/lookup/explainer.rb', line 14

def to_hash
  hash = {}
  hash[:branches] = @branches.map {|b| b.to_hash} unless @branches.nil? || @branches.empty?
  hash
end

#to_sObject



20
21
22
23
24
# File 'lib/puppet/pops/lookup/explainer.rb', line 20

def to_s
  io = StringIO.new
  dump_on(io, '', '')
  io.string
end