Class: Puppet::Pops::Lookup::Explainer
- Inherits:
-
ExplainNode
- Object
- ExplainNode
- Puppet::Pops::Lookup::Explainer
- Defined in:
- lib/puppet/pops/lookup/explainer.rb
Direct Known Subclasses
Instance Method Summary collapse
- #accept_found(key, value) ⇒ Object
- #accept_found_in_defaults(key, value) ⇒ Object
- #accept_found_in_overrides(key, value) ⇒ Object
- #accept_merge_source(merge_source) ⇒ Object
- #accept_module_not_found ⇒ Object
- #accept_not_found(key) ⇒ Object
- #accept_path_not_found ⇒ Object
- #accept_result(result) ⇒ Object
- #accept_text(text) ⇒ Object
- #dump_on(io, indent, first_indent) ⇒ Object
- #explain_options? ⇒ Boolean
-
#initialize(explain_options = false, only_explain_options = false) ⇒ Explainer
constructor
A new instance of Explainer.
- #only_explain_options? ⇒ Boolean
- #pop ⇒ Object
- #push(qualifier_type, qualifier) ⇒ Object
- #to_hash ⇒ Object
Methods inherited from ExplainNode
Constructor Details
#initialize(explain_options = false, only_explain_options = false) ⇒ Explainer
Returns a new instance of Explainer.
432 433 434 435 436 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 432 def initialize( = false, = false) @current = self @explain_options = @only_explain_options = end |
Instance Method Details
#accept_found(key, value) ⇒ Object
489 490 491 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 489 def accept_found(key, value) @current.found(key, value) end |
#accept_found_in_defaults(key, value) ⇒ Object
485 486 487 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 485 def accept_found_in_defaults(key, value) @current.found_in_defaults(key, value) end |
#accept_found_in_overrides(key, value) ⇒ Object
481 482 483 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 481 def accept_found_in_overrides(key, value) @current.found_in_overrides(key, value) end |
#accept_merge_source(merge_source) ⇒ Object
493 494 495 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 493 def accept_merge_source(merge_source) @current.branches << ExplainMergeSource.new(merge_source) end |
#accept_module_not_found ⇒ Object
505 506 507 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 505 def accept_module_not_found @current.module_not_found end |
#accept_not_found(key) ⇒ Object
497 498 499 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 497 def accept_not_found(key) @current.not_found(key) end |
#accept_path_not_found ⇒ Object
501 502 503 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 501 def accept_path_not_found @current.path_not_found end |
#accept_result(result) ⇒ Object
509 510 511 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 509 def accept_result(result) @current.result(result) end |
#accept_text(text) ⇒ Object
513 514 515 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 513 def accept_text(text) @current.text(text) end |
#dump_on(io, indent, first_indent) ⇒ Object
517 518 519 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 517 def dump_on(io, indent, first_indent) branches.each { |b| b.dump_on(io, indent, first_indent) } end |
#explain_options? ⇒ Boolean
473 474 475 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 473 def @explain_options end |
#only_explain_options? ⇒ Boolean
469 470 471 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 469 def @only_explain_options end |
#pop ⇒ Object
477 478 479 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 477 def pop @current = @current.parent unless @current.parent.nil? end |
#push(qualifier_type, qualifier) ⇒ Object
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 438 def push(qualifier_type, qualifier) node = case (qualifier_type) when :global ExplainGlobal.new(@current, qualifier) when :path ExplainPath.new(@current, qualifier) when :module ExplainModule.new(@current, qualifier) when :interpolate ExplainInterpolate.new(@current, qualifier) when :data_provider ExplainDataProvider.new(@current, qualifier) when :merge ExplainMerge.new(@current, qualifier) when :scope ExplainScope.new(@current) when :sub_lookup ExplainSubLookup.new(@current, qualifier) when :segment ExplainKeySegment.new(@current, qualifier) when :meta, :data ExplainTop.new(@current, qualifier_type, qualifier) when :invalid_key ExplainInvalidKey.new(@current, qualifier) else raise ArgumentError, "Unknown Explain type #{qualifier_type}" end @current.branches << node @current = node end |
#to_hash ⇒ Object
521 522 523 |
# File 'lib/puppet/pops/lookup/explainer.rb', line 521 def to_hash branches.size == 1 ? branches[0].to_hash : super end |