Class: Puppet::Pops::Model::AttributesOperation
- Inherits:
-
AbstractAttributeOperation
- Object
- PopsObject
- Positioned
- AbstractAttributeOperation
- Puppet::Pops::Model::AttributesOperation
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #expr ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, 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 {|@expr| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, expr) ⇒ AttributesOperation
constructor
A new instance of AttributesOperation.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, expr) ⇒ AttributesOperation
Returns a new instance of AttributesOperation.
1657 1658 1659 1660 1661 |
# File 'lib/puppet/pops/model/ast.rb', line 1657 def initialize(locator, offset, length, expr) super(locator, offset, length) @hash = @hash ^ expr.hash @expr = expr end |
Instance Attribute Details
#expr ⇒ Object (readonly)
1655 1656 1657 |
# File 'lib/puppet/pops/model/ast.rb', line 1655 def expr @expr end |
Class Method Details
._pcore_type ⇒ Object
1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 |
# File 'lib/puppet/pops/model/ast.rb', line 1622 def self._pcore_type @_pcore_type ||= Types::PObjectType .new('Puppet::AST::AttributesOperation', { 'parent' => AbstractAttributeOperation._pcore_type, 'attributes' => { 'expr' => Expression._pcore_type } }) end |
.create(locator, offset, length, expr) ⇒ Object
1645 1646 1647 1648 1649 1650 1651 1652 1653 |
# File 'lib/puppet/pops/model/ast.rb', line 1645 def self.create(locator, offset, length, 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::AttributesOperation[expr]', attrs['expr'].type, expr) new(locator, offset, length, expr) end |
.from_asserted_hash(init_hash) ⇒ Object
1637 1638 1639 1640 1641 1642 1643 |
# File 'lib/puppet/pops/model/ast.rb', line 1637 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['expr']) end |
.from_hash(init_hash) ⇒ Object
1633 1634 1635 |
# File 'lib/puppet/pops/model/ast.rb', line 1633 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::AttributesOperation initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
1673 1674 1675 1676 1677 1678 1679 1680 |
# File 'lib/puppet/pops/model/ast.rb', line 1673 def _pcore_all_contents(path, &block) path << self unless @expr.nil? block.call(@expr, path) @expr._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@expr| ... } ⇒ Object
1669 1670 1671 |
# File 'lib/puppet/pops/model/ast.rb', line 1669 def _pcore_contents yield(@expr) unless @expr.nil? end |
#_pcore_init_hash ⇒ Object
1663 1664 1665 1666 1667 |
# File 'lib/puppet/pops/model/ast.rb', line 1663 def _pcore_init_hash result = super result['expr'] = @expr result end |
#eql?(o) ⇒ Boolean Also known as: ==
1682 1683 1684 1685 |
# File 'lib/puppet/pops/model/ast.rb', line 1682 def eql?(o) super && @expr.eql?(o.expr) end |