Class: Puppet::Pops::Model::EppExpression

Inherits:
Expression show all
Defined in:
lib/puppet/pops/model/ast.rb

Instance Attribute Summary collapse

Attributes inherited from Positioned

#length, #locator, #offset

Attributes inherited from PopsObject

#hash

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Positioned

#file, #line, #pos

Methods inherited from PopsObject

#to_s

Methods included from Types::PuppetObject

#_pcore_type

Constructor Details

#initialize(locator, offset, length, parameters_specified = nil, body = nil) ⇒ EppExpression

Returns a new instance of EppExpression.



3861
3862
3863
3864
3865
3866
# File 'lib/puppet/pops/model/ast.rb', line 3861

def initialize(locator, offset, length, parameters_specified = nil, body = nil)
  super(locator, offset, length)
  @hash = @hash ^ parameters_specified.hash ^ body.hash
  @parameters_specified = parameters_specified
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)



3859
3860
3861
# File 'lib/puppet/pops/model/ast.rb', line 3859

def body
  @body
end

#parameters_specifiedObject (readonly)



3858
3859
3860
# File 'lib/puppet/pops/model/ast.rb', line 3858

def parameters_specified
  @parameters_specified
end

Class Method Details

._pcore_typeObject



3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
# File 'lib/puppet/pops/model/ast.rb', line 3818

def self._pcore_type
  @_pcore_type ||= Types::PObjectType.new('Puppet::AST::EppExpression', {
    'parent' => Expression._pcore_type,
    'attributes' => {
      'parameters_specified' => {
        'type' => Types::POptionalType.new(Types::PBooleanType::DEFAULT),
        'value' => nil
      },
      'body' => {
        'type' => Types::POptionalType.new(Expression._pcore_type),
        'value' => nil
      }
    }
  })
end

.create(locator, offset, length, parameters_specified = nil, body = nil) ⇒ Object



3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
# File 'lib/puppet/pops/model/ast.rb', line 3847

def self.create(locator, offset, length, parameters_specified = nil, 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::EppExpression[parameters_specified]', attrs['parameters_specified'].type, parameters_specified)
  ta.assert_instance_of('Puppet::AST::EppExpression[body]', attrs['body'].type, body)
  new(locator, offset, length, parameters_specified, body)
end

.from_asserted_hash(init_hash) ⇒ Object



3838
3839
3840
3841
3842
3843
3844
3845
# File 'lib/puppet/pops/model/ast.rb', line 3838

def self.from_asserted_hash(init_hash)
  new(
    init_hash['locator'],
    init_hash['offset'],
    init_hash['length'],
    init_hash['parameters_specified'],
    init_hash['body'])
end

.from_hash(init_hash) ⇒ Object



3834
3835
3836
# File 'lib/puppet/pops/model/ast.rb', line 3834

def self.from_hash(init_hash)
  from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::EppExpression initializer', _pcore_type.init_hash_type, init_hash))
end

Instance Method Details

#_pcore_all_contents(path, &block) ⇒ Object



3879
3880
3881
3882
3883
3884
3885
3886
# File 'lib/puppet/pops/model/ast.rb', line 3879

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

Yields:



3875
3876
3877
# File 'lib/puppet/pops/model/ast.rb', line 3875

def _pcore_contents
  yield(@body) unless @body.nil?
end

#_pcore_init_hashObject



3868
3869
3870
3871
3872
3873
# File 'lib/puppet/pops/model/ast.rb', line 3868

def _pcore_init_hash
  result = super
  result['parameters_specified'] = @parameters_specified unless @parameters_specified == nil
  result['body'] = @body unless @body == nil
  result
end

#eql?(o) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


3888
3889
3890
3891
3892
# File 'lib/puppet/pops/model/ast.rb', line 3888

def eql?(o)
  super &&
  @parameters_specified.eql?(o.parameters_specified) &&
  @body.eql?(o.body)
end