class Puppet::Pops::Lookup::ExplainMerge

Public Class Methods

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

Public Instance Methods

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