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.



209
210
211
212
# File 'lib/puppet/pops/lookup/explainer.rb', line 209

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

Instance Method Details

#dump_on(io, indent, first_indent) ⇒ Object



214
215
216
217
218
219
220
221
222
223
224
# File 'lib/puppet/pops/lookup/explainer.rb', line 214

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



226
227
228
229
230
231
232
233
234
# File 'lib/puppet/pops/lookup/explainer.rb', line 226

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

#typeObject



236
237
238
# File 'lib/puppet/pops/lookup/explainer.rb', line 236

def type
  :module
end