Class: Puppet::Pops::Lookup::ExplainMerge Private
- Inherits:
-
ExplainTreeNode
- Object
- ExplainNode
- ExplainTreeNode
- Puppet::Pops::Lookup::ExplainMerge
- Defined in:
- lib/puppet/pops/lookup/explainer.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary
Attributes inherited from ExplainTreeNode
Instance Method Summary collapse
- #dump_on(io, indent, first_indent) ⇒ Object private
-
#initialize(parent, merge) ⇒ ExplainMerge
constructor
private
A new instance of ExplainMerge.
- #options_wo_strategy ⇒ Object private
- #to_hash ⇒ Object private
- #type ⇒ Object private
Methods inherited from ExplainTreeNode
#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
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ExplainMerge.
264 265 266 267 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 264 def initialize(parent, merge) super(parent) @merge = merge end |
Instance Method Details
#dump_on(io, indent, first_indent) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 269 def dump_on(io, indent, first_indent) return if branches.size == 0 # It's pointless to report a merge where there's only one branch 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) = unless .nil? io << indent << 'Options: ' dump_value(io, indent, ) 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
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
305 306 307 308 309 310 311 312 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 305 def = @merge. if !.nil? && .include?('strategy') = .dup .delete('strategy') end .empty? ? nil : end |
#to_hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
291 292 293 294 295 296 297 298 299 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 291 def to_hash return branches[0].to_hash if branches.size == 1 hash = super hash[:merge] = @merge.class.key = hash[:options] = unless .nil? hash end |
#type ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
301 302 303 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 301 def type :merge end |