Class: Puppet::Pops::Lookup::DebugExplainer Private

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

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Explainer

#accept_found, #accept_found_in_defaults, #accept_found_in_overrides, #accept_location_not_found, #accept_merge_source, #accept_module_not_found, #accept_module_provider_not_found, #accept_not_found, #accept_result, #accept_text, #explain_options?, #only_explain_options?, #pop, #push, #to_hash

Methods inherited from ExplainNode

#branches, #dump_texts, #explain, #inspect, #text, #to_hash, #to_s

Constructor Details

#initialize(wrapped_explainer) ⇒ DebugExplainer

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.

Returns a new instance of DebugExplainer.



572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/puppet/pops/lookup/explainer.rb', line 572

def initialize(wrapped_explainer)
  @wrapped_explainer = wrapped_explainer
  if wrapped_explainer.nil?
    @current = self
    @explain_options = false
    @only_explain_options = false
  else
    @current = wrapped_explainer
    @explain_options = wrapped_explainer.explain_options?
    @only_explain_options = wrapped_explainer.only_explain_options?
  end
end

Instance Attribute Details

#wrapped_explainerObject (readonly)

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.



570
571
572
# File 'lib/puppet/pops/lookup/explainer.rb', line 570

def wrapped_explainer
  @wrapped_explainer
end

Instance Method Details

#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.



585
586
587
# File 'lib/puppet/pops/lookup/explainer.rb', line 585

def dump_on(io, indent, first_indent)
  @current.equal?(self) ? super : @current.dump_on(io, indent, first_indent)
end

#emit_debug_info(preamble) ⇒ 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.



589
590
591
592
593
594
# File 'lib/puppet/pops/lookup/explainer.rb', line 589

def emit_debug_info(preamble)
  io = String.new
  io << preamble << "\n"
  dump_on(io, '  ', '  ')
  Puppet.debug(io.chomp!)
end