Class: Puppet::DataTypes::TypeBuilder Private
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #implementation ⇒ Object private
- #implementation_class ⇒ Object private
- #interface ⇒ Object private
Instance Method Summary collapse
- #create_type(loader) ⇒ Object private
- #has_implementation? ⇒ Boolean private
-
#initialize(type_name) ⇒ TypeBuilder
constructor
private
A new instance of TypeBuilder.
Constructor Details
#initialize(type_name) ⇒ TypeBuilder
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.
Returns a new instance of TypeBuilder.
149 150 151 152 153 |
# File 'lib/puppet/datatypes.rb', line 149 def initialize(type_name) @type_name = type_name @implementation = nil @implementation_class = nil end |
Instance Attribute Details
#implementation ⇒ 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.
147 148 149 |
# File 'lib/puppet/datatypes.rb', line 147 def implementation @implementation end |
#implementation_class ⇒ 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.
147 148 149 |
# File 'lib/puppet/datatypes.rb', line 147 def implementation_class @implementation_class end |
#interface ⇒ 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.
147 148 149 |
# File 'lib/puppet/datatypes.rb', line 147 def interface @interface end |
Instance Method Details
#create_type(loader) ⇒ 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.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/puppet/datatypes.rb', line 155 def create_type(loader) raise ArgumentError, _('a data type must have an interface') unless @interface.is_a?(String) created_type = Puppet::Pops::Types::PObjectType.new( @type_name, Puppet::Pops::Parser::EvaluatingParser.new.parse_string("{ #{@interface} }").body ) if !@implementation_class.nil? if @implementation_class < Puppet::Pops::Types::PuppetObject @implementation_class.instance_eval do include Puppet::Pops::Types::PuppetObject @_pcore_type = created_type def self._pcore_type @_pcore_type end end else Puppet::Pops::Loaders.implementation_registry.register_implementation(created_type, @implementation_class) end created_type.implementation_class = @implementation_class elsif !@implementation.nil? created_type.implementation_override = @implementation end created_type end |
#has_implementation? ⇒ Boolean
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.
183 184 185 |
# File 'lib/puppet/datatypes.rb', line 183 def has_implementation? !(@implementation_class.nil? && @implementation.nil?) end |