Class: Puppet::Pops::Model::ResourceBody
- Inherits:
-
Positioned
- Object
- PopsObject
- Positioned
- Puppet::Pops::Model::ResourceBody
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #operations ⇒ Object readonly
- #title ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, title = nil, operations = _pcore_type['operations'].value) ⇒ Object
- .from_asserted_hash(init_hash) ⇒ Object
- .from_hash(init_hash) ⇒ Object
Instance Method Summary collapse
- #_pcore_all_contents(path, &block) ⇒ Object
- #_pcore_contents {|@title| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, title = nil, operations = _pcore_type['operations'].value) ⇒ ResourceBody
constructor
A new instance of ResourceBody.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, title = nil, operations = _pcore_type['operations'].value) ⇒ ResourceBody
Returns a new instance of ResourceBody.
3902 3903 3904 3905 3906 3907 |
# File 'lib/puppet/pops/model/ast.rb', line 3902 def initialize(locator, offset, length, title = nil, operations = _pcore_type['operations'].value) super(locator, offset, length) @hash = @hash ^ title.hash ^ operations.hash @title = title @operations = operations end |
Instance Attribute Details
#operations ⇒ Object (readonly)
3900 3901 3902 |
# File 'lib/puppet/pops/model/ast.rb', line 3900 def operations @operations end |
#title ⇒ Object (readonly)
3899 3900 3901 |
# File 'lib/puppet/pops/model/ast.rb', line 3899 def title @title end |
Class Method Details
._pcore_type ⇒ Object
3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 |
# File 'lib/puppet/pops/model/ast.rb', line 3859 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::ResourceBody', { 'parent' => Positioned._pcore_type, 'attributes' => { 'title' => { 'type' => Types::POptionalType.new(Expression._pcore_type), 'value' => nil }, 'operations' => { 'type' => Types::PArrayType.new(AbstractAttributeOperation._pcore_type), 'value' => [] } } }) end |
.create(locator, offset, length, title = nil, operations = _pcore_type['operations'].value) ⇒ Object
3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 |
# File 'lib/puppet/pops/model/ast.rb', line 3888 def self.create(locator, offset, length, title = nil, operations = _pcore_type['operations'].value) 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::ResourceBody[title]', attrs['title'].type, title) ta.assert_instance_of('Puppet::AST::ResourceBody[operations]', attrs['operations'].type, operations) new(locator, offset, length, title, operations) end |
.from_asserted_hash(init_hash) ⇒ Object
3879 3880 3881 3882 3883 3884 3885 3886 |
# File 'lib/puppet/pops/model/ast.rb', line 3879 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['title'], init_hash.fetch('operations') { _pcore_type['operations'].value }) end |
.from_hash(init_hash) ⇒ Object
3875 3876 3877 |
# File 'lib/puppet/pops/model/ast.rb', line 3875 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::ResourceBody initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 |
# File 'lib/puppet/pops/model/ast.rb', line 3921 def _pcore_all_contents(path, &block) path << self unless @title.nil? block.call(@title, path) @title._pcore_all_contents(path, &block) end @operations.each do |value| block.call(value, path) value._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@title| ... } ⇒ Object
3916 3917 3918 3919 |
# File 'lib/puppet/pops/model/ast.rb', line 3916 def _pcore_contents yield(@title) unless @title.nil? @operations.each { |value| yield(value) } end |
#_pcore_init_hash ⇒ Object
3909 3910 3911 3912 3913 3914 |
# File 'lib/puppet/pops/model/ast.rb', line 3909 def _pcore_init_hash result = super result['title'] = @title unless @title == nil result['operations'] = @operations unless _pcore_type['operations'].default_value?(@operations) result end |
#eql?(o) ⇒ Boolean Also known as: ==
3934 3935 3936 3937 3938 |
# File 'lib/puppet/pops/model/ast.rb', line 3934 def eql?(o) super && @title.eql?(o.title) && @operations.eql?(o.operations) end |