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

Public Instance Methods

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