Class: Puppet::Pops::Model::AttributeOperation
- Inherits:
-
AbstractAttributeOperation
- Object
- PopsObject
- Positioned
- AbstractAttributeOperation
- Puppet::Pops::Model::AttributeOperation
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #attribute_name ⇒ Object readonly
- #operator ⇒ 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, attribute_name, operator, 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 {|@value_expr| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, attribute_name, operator, value_expr) ⇒ AttributeOperation
constructor
A new instance of AttributeOperation.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, attribute_name, operator, value_expr) ⇒ AttributeOperation
Returns a new instance of AttributeOperation.
1542 1543 1544 1545 1546 1547 1548 |
# File 'lib/puppet/pops/model/ast.rb', line 1542 def initialize(locator, offset, length, attribute_name, operator, value_expr) super(locator, offset, length) @hash = @hash ^ attribute_name.hash ^ operator.hash ^ value_expr.hash @attribute_name = attribute_name @operator = operator @value_expr = value_expr end |
Instance Attribute Details
#attribute_name ⇒ Object (readonly)
1538 1539 1540 |
# File 'lib/puppet/pops/model/ast.rb', line 1538 def attribute_name @attribute_name end |
#operator ⇒ Object (readonly)
1539 1540 1541 |
# File 'lib/puppet/pops/model/ast.rb', line 1539 def operator @operator end |
#value_expr ⇒ Object (readonly)
1540 1541 1542 |
# File 'lib/puppet/pops/model/ast.rb', line 1540 def value_expr @value_expr end |
Class Method Details
._pcore_type ⇒ Object
1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 |
# File 'lib/puppet/pops/model/ast.rb', line 1501 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::AttributeOperation', { 'parent' => AbstractAttributeOperation._pcore_type, 'attributes' => { 'attribute_name' => Types::PStringType::DEFAULT, 'operator' => Types::PEnumType.new(['+>', '=>']), 'value_expr' => Expression._pcore_type } }) end |
.create(locator, offset, length, attribute_name, operator, value_expr) ⇒ Object
1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 |
# File 'lib/puppet/pops/model/ast.rb', line 1526 def self.create(locator, offset, length, attribute_name, operator, 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::AttributeOperation[attribute_name]', attrs['attribute_name'].type, attribute_name) ta.assert_instance_of('Puppet::AST::AttributeOperation[operator]', attrs['operator'].type, operator) ta.assert_instance_of('Puppet::AST::AttributeOperation[value_expr]', attrs['value_expr'].type, value_expr) new(locator, offset, length, attribute_name, operator, value_expr) end |
.from_asserted_hash(init_hash) ⇒ Object
1516 1517 1518 1519 1520 1521 1522 1523 1524 |
# File 'lib/puppet/pops/model/ast.rb', line 1516 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['attribute_name'], init_hash['operator'], init_hash['value_expr']) end |
.from_hash(init_hash) ⇒ Object
1512 1513 1514 |
# File 'lib/puppet/pops/model/ast.rb', line 1512 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::AttributeOperation initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
1562 1563 1564 1565 1566 1567 1568 1569 |
# File 'lib/puppet/pops/model/ast.rb', line 1562 def _pcore_all_contents(path, &block) path << self unless @value_expr.nil? block.call(@value_expr, path) @value_expr._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@value_expr| ... } ⇒ Object
1558 1559 1560 |
# File 'lib/puppet/pops/model/ast.rb', line 1558 def _pcore_contents yield(@value_expr) unless @value_expr.nil? end |
#_pcore_init_hash ⇒ Object
1550 1551 1552 1553 1554 1555 1556 |
# File 'lib/puppet/pops/model/ast.rb', line 1550 def _pcore_init_hash result = super result['attribute_name'] = @attribute_name result['operator'] = @operator result['value_expr'] = @value_expr result end |
#eql?(o) ⇒ Boolean Also known as: ==
1571 1572 1573 1574 1575 1576 |
# File 'lib/puppet/pops/model/ast.rb', line 1571 def eql?(o) super && @attribute_name.eql?(o.attribute_name) && @operator.eql?(o.operator) && @value_expr.eql?(o.value_expr) end |