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

Public Instance Methods

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