Class: Puppet::Pops::Types::TypedModelObject
- Includes:
- Adaptable, PuppetObject, Visitable
- Defined in:
- lib/puppet/pops/types/types.rb
Overview
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).
Direct Known Subclasses
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create_ptype(loader, ir, parent_name, attributes_hash = EMPTY_HASH) ⇒ Object
- .register_ptypes(loader, ir) ⇒ Object
Methods included from Visitable
Methods included from PuppetObject
#_pcore_all_contents, #_pcore_contents, #_pcore_init_hash, #_pcore_type, #to_s
Class Method Details
._pcore_type ⇒ Object
49 50 51 |
# File 'lib/puppet/pops/types/types.rb', line 49 def self._pcore_type @type end |
.create_ptype(loader, ir, parent_name, attributes_hash = EMPTY_HASH) ⇒ Object
53 54 55 |
# File 'lib/puppet/pops/types/types.rb', line 53 def self.create_ptype(loader, ir, parent_name, attributes_hash = EMPTY_HASH) @type = Pcore.create_object_type(loader, ir, self, "Pcore::#{simple_name}Type", "Pcore::#{parent_name}", attributes_hash) end |
.register_ptypes(loader, ir) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/puppet/pops/types/types.rb', line 57 def self.register_ptypes(loader, ir) types = [ Annotation.register_ptype(loader, ir), RubyMethod.register_ptype(loader, ir) ] Types.constants.each do |c| next if c == :PType || c == :PHostClassType cls = Types.const_get(c) next unless cls.is_a?(Class) && cls < self type = cls.register_ptype(loader, ir) types << type unless type.nil? end types.each { |type| type.resolve(loader) } end |