Class: Puppet::Pops::Lookup::ExplainDataProvider

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

Instance Attribute Summary

Attributes inherited from ExplainTreeNode

#event, #key, #parent, #value

Instance Method Summary collapse

Methods inherited from ExplainTreeNode

#dump_outcome, #dump_value, #found, #found_in_defaults, #found_in_overrides, #increase_indent, #location_not_found, #not_found, #result, #to_s

Methods inherited from ExplainNode

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

Constructor Details

#initialize(parent, provider) ⇒ ExplainDataProvider


338
339
340
341
# File 'lib/puppet/pops/lookup/explainer.rb', line 338

def initialize(parent, provider)
  super(parent)
  @provider = provider
end

Instance Method Details

#dump_on(io, indent, first_indent) ⇒ Object


343
344
345
346
347
348
349
350
351
352
# File 'lib/puppet/pops/lookup/explainer.rb', line 343

def dump_on(io, indent, first_indent)
  io << first_indent << @provider.name << "\n"
  indent = increase_indent(indent)
  if @provider.respond_to?(:config_path)
    path = @provider.config_path
    io << indent << 'Using configuration "' << path.to_s << "\"\n" unless path.nil?
  end
  branches.each {|b| b.dump_on(io, indent, indent)}
  dump_outcome(io, indent)
end

#to_hashObject


354
355
356
357
358
359
360
361
362
363
# File 'lib/puppet/pops/lookup/explainer.rb', line 354

def to_hash
  hash = super
  hash[:name] = @provider.name
  if @provider.respond_to?(:config_path)
    path = @provider.config_path
    hash[:configuration_path] = path.to_s unless path.nil?
  end
  hash[:module] = @provider.module_name if @provider.is_a?(ModuleDataProvider)
  hash
end

#typeObject


365
366
367
# File 'lib/puppet/pops/lookup/explainer.rb', line 365

def type
  :data_provider
end