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, #module_not_found, #not_found, #path_not_found, #result
Methods inherited from ExplainNode
#branches, #to_s
Constructor Details
#initialize(parent, merge) ⇒ ExplainMerge
Returns a new instance of ExplainMerge.
210
211
212
213
|
# File 'lib/puppet/pops/lookup/explainer.rb', line 210
def initialize(parent, merge)
super(parent)
@merge = merge
end
|
Instance Method Details
#dump_on(io, indent, first_indent) ⇒ Object
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
# File 'lib/puppet/pops/lookup/explainer.rb', line 215
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 << "\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
250
251
252
253
254
255
256
257
|
# File 'lib/puppet/pops/lookup/explainer.rb', line 250
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
|
237
238
239
240
241
242
243
244
|
# File 'lib/puppet/pops/lookup/explainer.rb', line 237
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
|
246
247
248
|
# File 'lib/puppet/pops/lookup/explainer.rb', line 246
def type
:merge
end
|