class Puppet::Pops::Model::TypeAlias

Attributes

type_expr[R]

Public Class Methods

_pcore_type() click to toggle source
     # File lib/puppet/pops/model/ast.rb
2113 def self._pcore_type
2114   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::TypeAlias', {
2115     'parent' => QRefDefinition._pcore_type,
2116     'attributes' => {
2117       'type_expr' => {
2118         'type' => Types::POptionalType.new(Expression._pcore_type),
2119         'value' => nil
2120       }
2121     }
2122   })
2123 end
create(locator, offset, length, name, type_expr = nil) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2138 def self.create(locator, offset, length, name, type_expr = nil)
2139   ta = Types::TypeAsserter
2140   attrs = _pcore_type.attributes(true)
2141   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
2142   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
2143   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
2144   ta.assert_instance_of('Puppet::AST::QRefDefinition[name]', attrs['name'].type, name)
2145   ta.assert_instance_of('Puppet::AST::TypeAlias[type_expr]', attrs['type_expr'].type, type_expr)
2146   new(locator, offset, length, name, type_expr)
2147 end
from_asserted_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2129 def self.from_asserted_hash(init_hash)
2130   new(
2131     init_hash['locator'],
2132     init_hash['offset'],
2133     init_hash['length'],
2134     init_hash['name'],
2135     init_hash['type_expr'])
2136 end
from_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2125 def self.from_hash(init_hash)
2126   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::TypeAlias initializer', _pcore_type.init_hash_type, init_hash))
2127 end
new(locator, offset, length, name, type_expr = nil) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2151 def initialize(locator, offset, length, name, type_expr = nil)
2152   super(locator, offset, length, name)
2153   @hash = @hash ^ type_expr.hash
2154   @type_expr = type_expr
2155 end

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2167 def _pcore_all_contents(path, &block)
2168   path << self
2169   unless @type_expr.nil?
2170     block.call(@type_expr, path)
2171     @type_expr._pcore_all_contents(path, &block)
2172   end
2173   path.pop
2174 end
_pcore_contents() { |type_expr| ... } click to toggle source
     # File lib/puppet/pops/model/ast.rb
2163 def _pcore_contents
2164   yield(@type_expr) unless @type_expr.nil?
2165 end
_pcore_init_hash() click to toggle source
Calls superclass method Puppet::Pops::Model::QRefDefinition#_pcore_init_hash
     # File lib/puppet/pops/model/ast.rb
2157 def _pcore_init_hash
2158   result = super
2159   result['type_expr'] = @type_expr unless @type_expr == nil
2160   result
2161 end
eql?(o) click to toggle source
     # File lib/puppet/pops/model/ast.rb
2176 def eql?(o)
2177   super &&
2178   @type_expr.eql?(o.type_expr)
2179 end
Also aliased as: ==