Class: Puppet::Pops::Model::SelectorEntry
- Inherits:
-
Positioned
- Object
- PopsObject
- Positioned
- Puppet::Pops::Model::SelectorEntry
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #matching_expr ⇒ Object readonly
- #value_expr ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, matching_expr, value_expr) ⇒ Object
- .from_asserted_hash(init_hash) ⇒ Object
- .from_hash(init_hash) ⇒ Object
Instance Method Summary collapse
- #_pcore_all_contents(path, &block) ⇒ Object
- #_pcore_contents {|@matching_expr| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, matching_expr, value_expr) ⇒ SelectorEntry
constructor
A new instance of SelectorEntry.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, matching_expr, value_expr) ⇒ SelectorEntry
Returns a new instance of SelectorEntry.
4304 4305 4306 4307 4308 4309 |
# File 'lib/puppet/pops/model/ast.rb', line 4304 def initialize(locator, offset, length, matching_expr, value_expr) super(locator, offset, length) @hash = @hash ^ matching_expr.hash ^ value_expr.hash @matching_expr = matching_expr @value_expr = value_expr end |
Instance Attribute Details
#matching_expr ⇒ Object (readonly)
4301 4302 4303 |
# File 'lib/puppet/pops/model/ast.rb', line 4301 def matching_expr @matching_expr end |
#value_expr ⇒ Object (readonly)
4302 4303 4304 |
# File 'lib/puppet/pops/model/ast.rb', line 4302 def value_expr @value_expr end |
Class Method Details
._pcore_type ⇒ Object
4267 4268 4269 4270 4271 4272 4273 4274 4275 |
# File 'lib/puppet/pops/model/ast.rb', line 4267 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::SelectorEntry', { 'parent' => Positioned._pcore_type, 'attributes' => { 'matching_expr' => Expression._pcore_type, 'value_expr' => Expression._pcore_type } }) end |
.create(locator, offset, length, matching_expr, value_expr) ⇒ Object
4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 |
# File 'lib/puppet/pops/model/ast.rb', line 4290 def self.create(locator, offset, length, matching_expr, value_expr) ta = Types::TypeAsserter attrs = _pcore_type.attributes(true) ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator) ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset) ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length) ta.assert_instance_of('Puppet::AST::SelectorEntry[matching_expr]', attrs['matching_expr'].type, matching_expr) ta.assert_instance_of('Puppet::AST::SelectorEntry[value_expr]', attrs['value_expr'].type, value_expr) new(locator, offset, length, matching_expr, value_expr) end |
.from_asserted_hash(init_hash) ⇒ Object
4281 4282 4283 4284 4285 4286 4287 4288 |
# File 'lib/puppet/pops/model/ast.rb', line 4281 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['matching_expr'], init_hash['value_expr']) end |
.from_hash(init_hash) ⇒ Object
4277 4278 4279 |
# File 'lib/puppet/pops/model/ast.rb', line 4277 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::SelectorEntry initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 |
# File 'lib/puppet/pops/model/ast.rb', line 4323 def _pcore_all_contents(path, &block) path << self unless @matching_expr.nil? block.call(@matching_expr, path) @matching_expr._pcore_all_contents(path, &block) end unless @value_expr.nil? block.call(@value_expr, path) @value_expr._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@matching_expr| ... } ⇒ Object
4318 4319 4320 4321 |
# File 'lib/puppet/pops/model/ast.rb', line 4318 def _pcore_contents yield(@matching_expr) unless @matching_expr.nil? yield(@value_expr) unless @value_expr.nil? end |
#_pcore_init_hash ⇒ Object
4311 4312 4313 4314 4315 4316 |
# File 'lib/puppet/pops/model/ast.rb', line 4311 def _pcore_init_hash result = super result['matching_expr'] = @matching_expr result['value_expr'] = @value_expr result end |
#eql?(o) ⇒ Boolean Also known as: ==
4336 4337 4338 4339 4340 |
# File 'lib/puppet/pops/model/ast.rb', line 4336 def eql?(o) super && @matching_expr.eql?(o.matching_expr) && @value_expr.eql?(o.value_expr) end |