Class: Puppet::Pops::Model::QualifiedName

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, value) ⇒ QualifiedName

Returns a new instance of QualifiedName.



3664
3665
3666
3667
3668
# File 'lib/puppet/pops/model/ast.rb', line 3664

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

Instance Attribute Details

#valueObject (readonly)



3662
3663
3664
# File 'lib/puppet/pops/model/ast.rb', line 3662

def value
  @value
end

Class Method Details

._pcore_typeObject



3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
# File 'lib/puppet/pops/model/ast.rb', line 3629

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

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



3652
3653
3654
3655
3656
3657
3658
3659
3660
# File 'lib/puppet/pops/model/ast.rb', line 3652

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

.from_asserted_hash(init_hash) ⇒ Object



3644
3645
3646
3647
3648
3649
3650
# File 'lib/puppet/pops/model/ast.rb', line 3644

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

.from_hash(init_hash) ⇒ Object



3640
3641
3642
# File 'lib/puppet/pops/model/ast.rb', line 3640

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

Instance Method Details

#_pcore_init_hashObject



3670
3671
3672
3673
3674
# File 'lib/puppet/pops/model/ast.rb', line 3670

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

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

Returns:

  • (Boolean)


3676
3677
3678
3679
# File 'lib/puppet/pops/model/ast.rb', line 3676

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