Class: Puppet::Pops::Binder::Producers::MultibindProducer Abstract
- Inherits:
-
AbstractArgumentedProducer
- Object
- Producer
- AbstractArgumentedProducer
- Puppet::Pops::Binder::Producers::MultibindProducer
- Defined in:
- lib/puppet/pops/binder/producers.rb
Overview
This class is abstract.
Abstract base class for multibind producers. Is suitable as base class for custom implementations of multibind producers.
Direct Known Subclasses
Instance Attribute Summary collapse
- #contributions_key ⇒ Object readonly
Attributes inherited from AbstractArgumentedProducer
Attributes inherited from Producer
Instance Method Summary collapse
-
#initialize(injector, binding, scope, options) ⇒ MultibindProducer
constructor
A new instance of MultibindProducer.
-
#type_error_detail(expected, actual) ⇒ String
private
A formatted string for inclusion as detail in an error message.
Methods inherited from Producer
Constructor Details
#initialize(injector, binding, scope, options) ⇒ MultibindProducer
Returns a new instance of MultibindProducer.
522 523 524 525 |
# File 'lib/puppet/pops/binder/producers.rb', line 522 def initialize(injector, binding, scope, ) super @contributions_key = injector.key_factory.multibind_contributions(binding.id) end |
Instance Attribute Details
#contributions_key ⇒ Object (readonly)
513 514 515 |
# File 'lib/puppet/pops/binder/producers.rb', line 513 def contributions_key @contributions_key end |
Instance Method Details
#type_error_detail(expected, actual) ⇒ String
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 formatted string for inclusion as detail in an error message.
532 533 534 535 536 537 538 |
# File 'lib/puppet/pops/binder/producers.rb', line 532 def type_error_detail(expected, actual) tc = injector.type_calculator expected = [expected] unless expected.is_a?(Array) actual_t = tc.is_ptype?(actual) ? actual : tc.infer(actual) expstrs = expected.collect {|t| tc.string(t) } "expected: #{expstrs.join(', or ')}, got: #{tc.string(actual_t)}" end |