Class: Puppet::Pops::Lookup::ExplainModule

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, #module_not_found, #not_found, #path_not_found, #result

Methods inherited from ExplainNode

#branches, #to_s

Constructor Details

#initialize(parent, mod) ⇒ ExplainModule

Returns a new instance of ExplainModule.



261
262
263
264
# File 'lib/puppet/pops/lookup/explainer.rb', line 261

def initialize(parent, mod)
  super(parent)
  @module = mod
end

Instance Method Details

#dump_on(io, indent, first_indent) ⇒ Object



266
267
268
269
270
271
272
273
274
275
276
# File 'lib/puppet/pops/lookup/explainer.rb', line 266

def dump_on(io, indent, first_indent)
  io << indent << 'Module "' << @module << '"'
  if branches.size == 1
    branches[0].dump_on(io, indent, ' using ')
  else
    io << "\n"
    indent = increase_indent(indent)
    branches.each {|b| b.dump_on(io, indent, indent)}
  end
  io << indent << "Module not found\n" if @event == :module_not_found
end

#to_hashObject



278
279
280
281
282
283
284
285
286
# File 'lib/puppet/pops/lookup/explainer.rb', line 278

def to_hash
  if branches.size == 1
    branches[0].to_hash.merge(:module => @module)
  else
    hash = super
    hash[:module] = @module
    hash
  end
end

#typeObject



288
289
290
# File 'lib/puppet/pops/lookup/explainer.rb', line 288

def type
  :module
end