Class: Puppet::Pops::Binder::Producers::InstantiatingProducer

Inherits:
AbstractArgumentedProducer show all
Defined in:
lib/puppet/pops/binder/producers.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractArgumentedProducer

#binding, #injector

Attributes inherited from Producer

#transformer

Instance Method Summary collapse

Methods inherited from Producer

#produce, #producer

Constructor Details

#initialize(injector, binding, scope, options) ⇒ InstantiatingProducer

Returns a new instance of InstantiatingProducer.

Parameters:

Options Hash (options):

Raises:

  • (ArgumentError)


215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/puppet/pops/binder/producers.rb', line 215

def initialize(injector, binding, scope, options)
  # Better do this, even if a transformation of a created instance is kind of an odd thing to do, one can imagine
  # sending it to a function for further detailing.
  #
  super
  class_name = options[:class_name]
  raise ArgumentError, "Option 'class_name' must be given for an InstantiatingProducer" unless class_name
  # get class by name
  @the_class = Puppet::Pops::Types::ClassLoader.provide(class_name)
  @init_args = options[:init_args] || []
  raise ArgumentError, "Can not load the class #{class_name} specified in binding named: '#{binding.name}'" unless @the_class
end

Instance Attribute Details

#init_argsObject (readonly)



205
206
207
# File 'lib/puppet/pops/binder/producers.rb', line 205

def init_args
  @init_args
end

#the_classObject (readonly)



202
203
204
# File 'lib/puppet/pops/binder/producers.rb', line 202

def the_class
  @the_class
end