class Puppet::Pops::Model::LiteralHash

Attributes

entries[R]

Public Class Methods

_pcore_type() click to toggle source
     # File lib/puppet/pops/model/ast.rb
1082 def self._pcore_type
1083   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::LiteralHash', {
1084     'parent' => Expression._pcore_type,
1085     'attributes' => {
1086       'entries' => {
1087         'type' => Types::PArrayType.new(KeyedEntry._pcore_type),
1088         'value' => []
1089       }
1090     }
1091   })
1092 end
create(locator, offset, length, entries = _pcore_type['entries'].value) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1106 def self.create(locator, offset, length, entries = _pcore_type['entries'].value)
1107   ta = Types::TypeAsserter
1108   attrs = _pcore_type.attributes(true)
1109   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
1110   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
1111   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
1112   ta.assert_instance_of('Puppet::AST::LiteralHash[entries]', attrs['entries'].type, entries)
1113   new(locator, offset, length, entries)
1114 end
from_asserted_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1098 def self.from_asserted_hash(init_hash)
1099   new(
1100     init_hash['locator'],
1101     init_hash['offset'],
1102     init_hash['length'],
1103     init_hash.fetch('entries') { _pcore_type['entries'].value })
1104 end
from_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1094 def self.from_hash(init_hash)
1095   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::LiteralHash initializer', _pcore_type.init_hash_type, init_hash))
1096 end
new(locator, offset, length, entries = _pcore_type['entries'].value) click to toggle source
Calls superclass method Puppet::Pops::Model::Positioned::new
     # File lib/puppet/pops/model/ast.rb
1118 def initialize(locator, offset, length, entries = _pcore_type['entries'].value)
1119   super(locator, offset, length)
1120   @hash = @hash ^ entries.hash
1121   @entries = entries
1122 end

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1134 def _pcore_all_contents(path, &block)
1135   path << self
1136   @entries.each do |value|
1137     block.call(value, path)
1138     value._pcore_all_contents(path, &block)
1139   end
1140   path.pop
1141 end
_pcore_contents() { |value| ... } click to toggle source
     # File lib/puppet/pops/model/ast.rb
1130 def _pcore_contents
1131   @entries.each { |value| yield(value) }
1132 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
1124 def _pcore_init_hash
1125   result = super
1126   result['entries'] = @entries unless _pcore_type['entries'].default_value?(@entries)
1127   result
1128 end
eql?(o) click to toggle source
Calls superclass method Puppet::Pops::Model::PopsObject#eql?
     # File lib/puppet/pops/model/ast.rb
1143 def eql?(o)
1144   super &&
1145   @entries.eql?(o.entries)
1146 end
Also aliased as: ==