class Puppet::Pops::Model::KeyedEntry

Attributes

key[R]
value[R]

Public Class Methods

_pcore_type() click to toggle source
     # File lib/puppet/pops/model/ast.rb
1005 def self._pcore_type
1006   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::KeyedEntry', {
1007     'parent' => Positioned._pcore_type,
1008     'attributes' => {
1009       'key' => Expression._pcore_type,
1010       'value' => Expression._pcore_type
1011     }
1012   })
1013 end
create(locator, offset, length, key, value) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1028 def self.create(locator, offset, length, key, value)
1029   ta = Types::TypeAsserter
1030   attrs = _pcore_type.attributes(true)
1031   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
1032   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
1033   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
1034   ta.assert_instance_of('Puppet::AST::KeyedEntry[key]', attrs['key'].type, key)
1035   ta.assert_instance_of('Puppet::AST::KeyedEntry[value]', attrs['value'].type, value)
1036   new(locator, offset, length, key, value)
1037 end
from_asserted_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1019 def self.from_asserted_hash(init_hash)
1020   new(
1021     init_hash['locator'],
1022     init_hash['offset'],
1023     init_hash['length'],
1024     init_hash['key'],
1025     init_hash['value'])
1026 end
from_hash(init_hash) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1015 def self.from_hash(init_hash)
1016   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::KeyedEntry initializer', _pcore_type.init_hash_type, init_hash))
1017 end
new(locator, offset, length, key, value) click to toggle source
Calls superclass method Puppet::Pops::Model::Positioned::new
     # File lib/puppet/pops/model/ast.rb
1042 def initialize(locator, offset, length, key, value)
1043   super(locator, offset, length)
1044   @hash = @hash ^ key.hash ^ value.hash
1045   @key = key
1046   @value = value
1047 end

Public Instance Methods

==(o)
Alias for: eql?
_pcore_all_contents(path, &block) click to toggle source
     # File lib/puppet/pops/model/ast.rb
1061 def _pcore_all_contents(path, &block)
1062   path << self
1063   unless @key.nil?
1064     block.call(@key, path)
1065     @key._pcore_all_contents(path, &block)
1066   end
1067   unless @value.nil?
1068     block.call(@value, path)
1069     @value._pcore_all_contents(path, &block)
1070   end
1071   path.pop
1072 end
_pcore_contents() { |key| ... } click to toggle source
     # File lib/puppet/pops/model/ast.rb
1056 def _pcore_contents
1057   yield(@key) unless @key.nil?
1058   yield(@value) unless @value.nil?
1059 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
1049 def _pcore_init_hash
1050   result = super
1051   result['key'] = @key
1052   result['value'] = @value
1053   result
1054 end
eql?(o) click to toggle source
Calls superclass method Puppet::Pops::Model::PopsObject#eql?
     # File lib/puppet/pops/model/ast.rb
1074 def eql?(o)
1075   super &&
1076   @key.eql?(o.key) &&
1077   @value.eql?(o.value)
1078 end
Also aliased as: ==