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

Inherits:
Object
  • Object
show all
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.

API:

  • private

Direct Known Subclasses

ExplainMergeSource, ExplainTreeNode, Explainer

Instance Method Summary collapse

Instance Method Details

#branchesObject

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.

API:

  • private



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.

API:

  • private



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.

API:

  • private



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

#explainObject

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.

API:

  • private



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

def explain
  io = ''
  dump_on(io, '', '')
  io
end

#inspectObject

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.

API:

  • private



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.

API:

  • private



37
38
39
40
# File 'lib/puppet/pops/lookup/explainer.rb', line 37

def text(text)
  @texts ||= []
  @texts << text
end

#to_hashObject

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.

API:

  • private



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_sObject

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.

API:

  • private



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