Method: Puppet::Pops::Types::PObjectType#implementation_class
- Defined in:
- lib/puppet/pops/types/p_object_type.rb
#implementation_class(create = true) ⇒ 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.
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 551 def implementation_class(create = true) if @implementation_class.nil? && create ir = Loaders.implementation_registry class_name = ir.nil? ? nil : ir.module_name_for_type(self) if class_name.nil? # Use generator to create a default implementation @implementation_class = RubyGenerator.new.create_class(self) @implementation_class.class_eval(&@implementation_override) if instance_variable_defined?(:@implementation_override) else # Can the mapping be loaded? @implementation_class = ClassLoader.provide(class_name) raise Puppet::Error, "Unable to load class #{class_name}" if @implementation_class.nil? unless @implementation_class < PuppetObject || @implementation_class.respond_to?(:ecore) raise Puppet::Error, "Unable to create an instance of #{name}. #{class_name} does not include module #{PuppetObject.name}" end end end @implementation_class end |