class Puppet::Pops::Model::LiteralHash

Attributes

entries[R]

Public Class Methods

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

Public Instance Methods

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