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, #to_s

Constructor Details

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

Returns a new instance of EppExpression


3984
3985
3986
3987
3988
3989
# File 'lib/puppet/pops/model/ast.rb', line 3984

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)


3982
3983
3984
# File 'lib/puppet/pops/model/ast.rb', line 3982

def body
  @body
end

#parameters_specifiedObject (readonly)


3981
3982
3983
# File 'lib/puppet/pops/model/ast.rb', line 3981

def parameters_specified
  @parameters_specified
end

Class Method Details

._pcore_typeObject


3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
# File 'lib/puppet/pops/model/ast.rb', line 3941

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


3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
# File 'lib/puppet/pops/model/ast.rb', line 3970

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


3961
3962
3963
3964
3965
3966
3967
3968
# File 'lib/puppet/pops/model/ast.rb', line 3961

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


3957
3958
3959
# File 'lib/puppet/pops/model/ast.rb', line 3957

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


4002
4003
4004
4005
4006
4007
4008
4009
# File 'lib/puppet/pops/model/ast.rb', line 4002

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:


3998
3999
4000
# File 'lib/puppet/pops/model/ast.rb', line 3998

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

#_pcore_init_hashObject


3991
3992
3993
3994
3995
3996
# File 'lib/puppet/pops/model/ast.rb', line 3991

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: ==


4011
4012
4013
4014
4015
# File 'lib/puppet/pops/model/ast.rb', line 4011

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