class Puppet::Pops::Lookup::ExplainMerge

Public Class Methods

new(parent, merge) click to toggle source
    # File lib/puppet/pops/lookup/explainer.rb
264 def initialize(parent, merge)
265   super(parent)
266   @merge = merge
267 end

Public Instance Methods

dump_on(io, indent, first_indent) click to toggle source
    # File lib/puppet/pops/lookup/explainer.rb
269 def dump_on(io, indent, first_indent)
270   return if branches.size == 0
271 
272   # It's pointless to report a merge where there's only one branch
273   return branches[0].dump_on(io, indent, first_indent) if branches.size == 1
274 
275   io << first_indent << 'Merge strategy ' << @merge.class.key.to_s << "\n"
276   indent = increase_indent(indent)
277   options = options_wo_strategy
278   unless options.nil?
279     io << indent << 'Options: '
280     dump_value(io, indent, options)
281     io << "\n"
282   end
283   branches.each {|b| b.dump_on(io, indent, indent)}
284   if @event == :result
285     io << indent << 'Merged result: '
286     dump_value(io, indent, @value)
287     io << "\n"
288   end
289 end
options_wo_strategy() click to toggle source
    # File lib/puppet/pops/lookup/explainer.rb
304 def options_wo_strategy
305   options = @merge.options
306   if !options.nil? && options.include?('strategy')
307     options = options.dup
308     options.delete('strategy')
309   end
310   options.empty? ? nil : options
311 end
to_hash() click to toggle source
    # File lib/puppet/pops/lookup/explainer.rb
291 def to_hash
292   return branches[0].to_hash if branches.size == 1
293   hash = super
294   hash[:merge] = @merge.class.key
295   options = options_wo_strategy
296   hash[:options] = options unless options.nil?
297   hash
298 end
type() click to toggle source
    # File lib/puppet/pops/lookup/explainer.rb
300 def type
301   :merge
302 end