class Puppet::Pops::Types::TypedModelObject

The Types model is a model of Puppet Language types.

The {TypeCalculator} should be used to answer questions about types. The {TypeFactory} or {TypeParser} should be used to create an instance of a type whenever one is needed.

The implementation of the Types model contains methods that are required for the type objects to behave as expected when comparing them and using them as keys in hashes. (No other logic is, or should be included directly in the model's classes).

@api public

Public Class Methods

_pcore_type() click to toggle source
   # File lib/puppet/pops/types/types.rb
48 def self._pcore_type
49   @type
50 end
create_ptype(loader, ir, parent_name, attributes_hash = EMPTY_HASH) click to toggle source
   # File lib/puppet/pops/types/types.rb
52 def self.create_ptype(loader, ir, parent_name, attributes_hash = EMPTY_HASH)
53   @type = Pcore::create_object_type(loader, ir, self, "Pcore::#{simple_name}Type", "Pcore::#{parent_name}", attributes_hash)
54 end
register_ptypes(loader, ir) click to toggle source
   # File lib/puppet/pops/types/types.rb
56 def self.register_ptypes(loader, ir)
57   types = [
58     Annotation.register_ptype(loader, ir),
59     RubyMethod.register_ptype(loader, ir),
60   ]
61   Types.constants.each do |c|
62     next if c == :PType || c == :PHostClassType
63     cls = Types.const_get(c)
64     next unless cls.is_a?(Class) && cls < self
65     type = cls.register_ptype(loader, ir)
66     types << type unless type.nil?
67   end
68   types.each { |type| type.resolve(loader) }
69 end