Method: Puppet::Pops::Pcore.create_object_type
- Defined in:
- lib/puppet/pops/pcore.rb
.create_object_type(loader, ir, impl_class, type_name, parent_name, attributes_hash = EMPTY_HASH, functions_hash = EMPTY_HASH, equality = nil) ⇒ PObjectType
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.
Create and register a new ‘Object` type in the Puppet Type System and map it to an implementation class
102 103 104 105 106 107 108 109 110 |
# File 'lib/puppet/pops/pcore.rb', line 102 def self.create_object_type(loader, ir, impl_class, type_name, parent_name, attributes_hash = EMPTY_HASH, functions_hash = EMPTY_HASH, equality = nil) init_hash = {} init_hash[Types::KEY_PARENT] = Types::PTypeReferenceType.new(parent_name) unless parent_name.nil? init_hash[Types::KEY_ATTRIBUTES] = attributes_hash unless attributes_hash.empty? init_hash[Types::KEY_FUNCTIONS] = functions_hash unless functions_hash.empty? init_hash[Types::KEY_EQUALITY] = equality unless equality.nil? ir.register_implementation(type_name, impl_class) add_type(Types::PObjectType.new(type_name, init_hash), loader) end |