Class: Puppet::Pops::Lookup::ExplainMerge
Instance Attribute Summary
#event, #key, #parent, #value
Instance Method Summary
collapse
#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, merge) ⇒ ExplainMerge
Returns a new instance of ExplainMerge.
263
264
265
266
|
# File 'lib/puppet/pops/lookup/explainer.rb', line 263
def initialize(parent, merge)
super(parent)
@merge = merge
end
|
Instance Method Details
#dump_on(io, indent, first_indent) ⇒ Object
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
# File 'lib/puppet/pops/lookup/explainer.rb', line 268
def dump_on(io, indent, first_indent)
return if branches.size == 0
return branches[0].dump_on(io, indent, first_indent) if branches.size == 1
io << first_indent << 'Merge strategy ' << @merge.class.key.to_s << "\n"
indent = increase_indent(indent)
options = options_wo_strategy
unless options.nil?
io << indent << 'Options: '
dump_value(io, indent, options)
io << "\n"
end
branches.each {|b| b.dump_on(io, indent, indent)}
if @event == :result
io << indent << 'Merged result: '
dump_value(io, indent, @value)
io << "\n"
end
end
|
#options_wo_strategy ⇒ Object
303
304
305
306
307
308
309
310
|
# File 'lib/puppet/pops/lookup/explainer.rb', line 303
def options_wo_strategy
options = @merge.options
if !options.nil? && options.include?('strategy')
options = options.dup
options.delete('strategy')
end
options.empty? ? nil : options
end
|
290
291
292
293
294
295
296
297
|
# File 'lib/puppet/pops/lookup/explainer.rb', line 290
def to_hash
return branches[0].to_hash if branches.size == 1
hash = super
hash[:merge] = @merge.class.key
options = options_wo_strategy
hash[:options] = options unless options.nil?
hash
end
|
299
300
301
|
# File 'lib/puppet/pops/lookup/explainer.rb', line 299
def type
:merge
end
|