Class: Puppet::Pops::Model::SiteDefinition
- Inherits:
-
Definition
- Object
- PopsObject
- Positioned
- Expression
- Definition
- Puppet::Pops::Model::SiteDefinition
- Defined in:
- lib/puppet/pops/model/ast.rb
Instance Attribute Summary collapse
- #body ⇒ Object readonly
Attributes inherited from Positioned
Attributes inherited from PopsObject
Class Method Summary collapse
- ._pcore_type ⇒ Object
- .create(locator, offset, length, body = nil) ⇒ Object
- .from_asserted_hash(init_hash) ⇒ Object
- .from_hash(init_hash) ⇒ Object
Instance Method Summary collapse
- #_pcore_all_contents(path, &block) ⇒ Object
- #_pcore_contents {|@body| ... } ⇒ Object
- #_pcore_init_hash ⇒ Object
- #eql?(o) ⇒ Boolean (also: #==)
-
#initialize(locator, offset, length, body = nil) ⇒ SiteDefinition
constructor
A new instance of SiteDefinition.
Methods inherited from Positioned
Methods inherited from PopsObject
Methods included from Types::PuppetObject
Constructor Details
#initialize(locator, offset, length, body = nil) ⇒ SiteDefinition
Returns a new instance of SiteDefinition.
2506 2507 2508 2509 2510 |
# File 'lib/puppet/pops/model/ast.rb', line 2506 def initialize(locator, offset, length, body = nil) super(locator, offset, length) @hash = @hash ^ body.hash @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
2504 2505 2506 |
# File 'lib/puppet/pops/model/ast.rb', line 2504 def body @body end |
Class Method Details
._pcore_type ⇒ Object
2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 |
# File 'lib/puppet/pops/model/ast.rb', line 2470 def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::SiteDefinition', { 'parent' => Definition._pcore_type, 'attributes' => { 'body' => { 'type' => Types::POptionalType.new(Expression._pcore_type), 'value' => nil } } }) end |
.create(locator, offset, length, body = nil) ⇒ Object
2494 2495 2496 2497 2498 2499 2500 2501 2502 |
# File 'lib/puppet/pops/model/ast.rb', line 2494 def self.create(locator, offset, length, body = nil) 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::SiteDefinition[body]', attrs['body'].type, body) new(locator, offset, length, body) end |
.from_asserted_hash(init_hash) ⇒ Object
2486 2487 2488 2489 2490 2491 2492 |
# File 'lib/puppet/pops/model/ast.rb', line 2486 def self.from_asserted_hash(init_hash) new( init_hash['locator'], init_hash['offset'], init_hash['length'], init_hash['body']) end |
.from_hash(init_hash) ⇒ Object
2482 2483 2484 |
# File 'lib/puppet/pops/model/ast.rb', line 2482 def self.from_hash(init_hash) from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::SiteDefinition initializer', _pcore_type.init_hash_type, init_hash)) end |
Instance Method Details
#_pcore_all_contents(path, &block) ⇒ Object
2522 2523 2524 2525 2526 2527 2528 2529 |
# File 'lib/puppet/pops/model/ast.rb', line 2522 def _pcore_all_contents(path, &block) path << self unless @body.nil? block.call(@body, path) @body._pcore_all_contents(path, &block) end path.pop end |
#_pcore_contents {|@body| ... } ⇒ Object
2518 2519 2520 |
# File 'lib/puppet/pops/model/ast.rb', line 2518 def _pcore_contents yield(@body) unless @body.nil? end |
#_pcore_init_hash ⇒ Object
2512 2513 2514 2515 2516 |
# File 'lib/puppet/pops/model/ast.rb', line 2512 def _pcore_init_hash result = super result['body'] = @body unless @body == nil result end |
#eql?(o) ⇒ Boolean Also known as: ==
2531 2532 2533 2534 |
# File 'lib/puppet/pops/model/ast.rb', line 2531 def eql?(o) super && @body.eql?(o.body) end |