Class: Puppet::Pops::Model::QualifiedReference

Inherits:
LiteralValue 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

#_pcore_all_contents, #_pcore_contents, #to_s

Methods included from Types::PuppetObject

#_pcore_all_contents, #_pcore_contents, #_pcore_type, #to_s

Constructor Details

#initialize(locator, offset, length, cased_value) ⇒ QualifiedReference

Returns a new instance of QualifiedReference


3900
3901
3902
3903
3904
# File 'lib/puppet/pops/model/ast.rb', line 3900

def initialize(locator, offset, length, cased_value)
  super(locator, offset, length)
  @hash = @hash ^ cased_value.hash
  @cased_value = cased_value
end

Instance Attribute Details

#cased_valueObject (readonly)


3894
3895
3896
# File 'lib/puppet/pops/model/ast.rb', line 3894

def cased_value
  @cased_value
end

Class Method Details

._pcore_typeObject


3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
# File 'lib/puppet/pops/model/ast.rb', line 3859

def self._pcore_type
  @_pcore_type ||= Types::PObjectType.new('Puppet::AST::QualifiedReference', {
    'parent' => LiteralValue._pcore_type,
    'attributes' => {
      'cased_value' => Types::PStringType::DEFAULT,
      'value' => {
        'type' => Types::PStringType::DEFAULT,
        'kind' => 'derived'
      }
    }
  })
end

.create(locator, offset, length, cased_value) ⇒ Object


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

def self.create(locator, offset, length, cased_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::QualifiedReference[cased_value]', attrs['cased_value'].type, cased_value)
  new(locator, offset, length, cased_value)
end

.from_asserted_hash(init_hash) ⇒ Object


3876
3877
3878
3879
3880
3881
3882
# File 'lib/puppet/pops/model/ast.rb', line 3876

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

.from_hash(init_hash) ⇒ Object


3872
3873
3874
# File 'lib/puppet/pops/model/ast.rb', line 3872

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

Instance Method Details

#_pcore_init_hashObject


3906
3907
3908
3909
3910
# File 'lib/puppet/pops/model/ast.rb', line 3906

def _pcore_init_hash
  result = super
  result['cased_value'] = @cased_value
  result
end

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


3912
3913
3914
3915
# File 'lib/puppet/pops/model/ast.rb', line 3912

def eql?(o)
  super &&
  @cased_value.eql?(o.cased_value)
end

#valueObject


3896
3897
3898
# File 'lib/puppet/pops/model/ast.rb', line 3896

def value
  @cased_value.downcase
end