Class: Puppet::Pops::Binder::BindingsFactory::MultibindingsBuilder
- Inherits:
-
BindingsBuilder
- Object
- AbstractBuilder
- BindingsBuilder
- Puppet::Pops::Binder::BindingsFactory::MultibindingsBuilder
- Defined in:
- lib/puppet/pops/binder/bindings_factory.rb
Overview
A builder specialized for multibind - checks that type is Array or Hash based. A new builder sets the multibinding to be of type Hash.
Instance Attribute Summary
Attributes inherited from AbstractBuilder
Instance Method Summary collapse
-
#data ⇒ Object
Overrides the default implementation that will raise an exception as a multibind requires a hash type.
-
#type(type) ⇒ Object
Constraints type to be one of PArrayType, or PHashType.
Methods inherited from BindingsBuilder
#abstract, #array_of, #array_of_data, #boolean, #final, #float, #hash_of, #hash_of_data, #in_multibind, #initialize, #instance_of, #integer, #name, #override, #pattern, #producer_options, #scalar, #string, #to, #to_first_found, #to_hash_lookup_of, #to_instance, #to_lookup_of, #to_producer, #to_producer_series, #to_series_of, #type_factory
Methods inherited from AbstractBuilder
Constructor Details
This class inherits a constructor from Puppet::Pops::Binder::BindingsFactory::BindingsBuilder
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Puppet::Pops::Binder::BindingsFactory::AbstractBuilder
Instance Method Details
#data ⇒ Object
Overrides the default implementation that will raise an exception as a multibind requires a hash type. Thus, if nothing else is requested, a multibind will be configured as Hash.
591 592 593 |
# File 'lib/puppet/pops/binder/bindings_factory.rb', line 591 def data() hash_of_data() end |
#type(type) ⇒ Object
Constraints type to be one of PArrayType, or PHashType.
580 581 582 583 584 585 586 |
# File 'lib/puppet/pops/binder/bindings_factory.rb', line 580 def type(type) unless type.class == Puppet::Pops::Types::PArrayType || type.class == Puppet::Pops::Types::PHashType raise ArgumentError, "Wrong type; only PArrayType, or PHashType allowed, got '#{type.to_s}'" end model.type = type self end |