class Puppet::Pops::Model::TypeMapping

Attributes

mapping_expr[R]
type_expr[R]

Public Class Methods

_pcore_type() click to toggle source
     # File lib/puppet/pops/model/ast.rb
2184 def self._pcore_type
2185   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::TypeMapping', {
2186     'parent' => Definition._pcore_type,
2187     'attributes' => {
2188       'type_expr' => {
2189         'type' => Types::POptionalType.new(Expression._pcore_type),
2190         'value' => nil
2191       },
2192       'mapping_expr' => {
2193         'type' => Types::POptionalType.new(Expression._pcore_type),
2194         'value' => nil
2195       }
2196     }
2197   })
2198 end
create(locator, offset, length, type_expr = nil, mapping_expr = nil) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2213 def self.create(locator, offset, length, type_expr = nil, mapping_expr = nil)
2214   ta = Types::TypeAsserter
2215   attrs = _pcore_type.attributes(true)
2216   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
2217   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
2218   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
2219   ta.assert_instance_of('Puppet::AST::TypeMapping[type_expr]', attrs['type_expr'].type, type_expr)
2220   ta.assert_instance_of('Puppet::AST::TypeMapping[mapping_expr]', attrs['mapping_expr'].type, mapping_expr)
2221   new(locator, offset, length, type_expr, mapping_expr)
2222 end
from_asserted_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2204 def self.from_asserted_hash(init_hash)
2205   new(
2206     init_hash['locator'],
2207     init_hash['offset'],
2208     init_hash['length'],
2209     init_hash['type_expr'],
2210     init_hash['mapping_expr'])
2211 end
from_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2200 def self.from_hash(init_hash)
2201   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::TypeMapping initializer', _pcore_type.init_hash_type, init_hash))
2202 end
new(locator, offset, length, type_expr = nil, mapping_expr = nil) click to toggle source
Calls superclass method Puppet::Pops::Model::Positioned::new
     # File lib/puppet/pops/model/ast.rb
2227 def initialize(locator, offset, length, type_expr = nil, mapping_expr = nil)
2228   super(locator, offset, length)
2229   @hash = @hash ^ type_expr.hash ^ mapping_expr.hash
2230   @type_expr = type_expr
2231   @mapping_expr = mapping_expr
2232 end

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2246 def _pcore_all_contents(path, &block)
2247   path << self
2248   unless @type_expr.nil?
2249     block.call(@type_expr, path)
2250     @type_expr._pcore_all_contents(path, &block)
2251   end
2252   unless @mapping_expr.nil?
2253     block.call(@mapping_expr, path)
2254     @mapping_expr._pcore_all_contents(path, &block)
2255   end
2256   path.pop
2257 end
_pcore_contents() { |type_expr| ... } click to toggle source
     # File lib/puppet/pops/model/ast.rb
2241 def _pcore_contents
2242   yield(@type_expr) unless @type_expr.nil?
2243   yield(@mapping_expr) unless @mapping_expr.nil?
2244 end
_pcore_init_hash() click to toggle source
Calls superclass method Puppet::Pops::Model::Positioned#_pcore_init_hash
     # File lib/puppet/pops/model/ast.rb
2234 def _pcore_init_hash
2235   result = super
2236   result['type_expr'] = @type_expr unless @type_expr == nil
2237   result['mapping_expr'] = @mapping_expr unless @mapping_expr == nil
2238   result
2239 end
eql?(o) click to toggle source
Calls superclass method Puppet::Pops::Model::PopsObject#eql?
     # File lib/puppet/pops/model/ast.rb
2259 def eql?(o)
2260   super &&
2261   @type_expr.eql?(o.type_expr) &&
2262   @mapping_expr.eql?(o.mapping_expr)
2263 end
Also aliased as: ==