class Puppet::Pops::Model::Positioned

Attributes

length[R]
locator[R]
offset[R]

Public Class Methods

_pcore_type() click to toggle source
   # File lib/puppet/pops/model/ast.rb
52 def self._pcore_type
53   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::Positioned', {
54     'parent' => PopsObject._pcore_type,
55     'attributes' => {
56       'locator' => {
57         'type' => Parser::Locator::Locator19._pcore_type,
58         'kind' => 'reference'
59       },
60       'offset' => Types::PIntegerType::DEFAULT,
61       'length' => Types::PIntegerType::DEFAULT,
62       'file' => {
63         'type' => Types::PStringType::DEFAULT,
64         'kind' => 'derived'
65       },
66       'line' => {
67         'type' => Types::PIntegerType::DEFAULT,
68         'kind' => 'derived'
69       },
70       'pos' => {
71         'type' => Types::PIntegerType::DEFAULT,
72         'kind' => 'derived'
73       }
74     },
75     'equality' => []
76   })
77 end
create(locator, offset, length) click to toggle source
   # File lib/puppet/pops/model/ast.rb
90 def self.create(locator, offset, length)
91   ta = Types::TypeAsserter
92   attrs = _pcore_type.attributes(true)
93   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
94   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
95   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
96   new(locator, offset, length)
97 end
from_asserted_hash(init_hash) click to toggle source
   # File lib/puppet/pops/model/ast.rb
83 def self.from_asserted_hash(init_hash)
84   new(
85     init_hash['locator'],
86     init_hash['offset'],
87     init_hash['length'])
88 end
from_hash(init_hash) click to toggle source
   # File lib/puppet/pops/model/ast.rb
79 def self.from_hash(init_hash)
80   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::Positioned initializer', _pcore_type.init_hash_type, init_hash))
81 end
new(locator, offset, length) click to toggle source
Calls superclass method Puppet::Pops::Model::PopsObject::new
    # File lib/puppet/pops/model/ast.rb
115 def initialize(locator, offset, length)
116   super()
117   @locator = locator
118   @offset = offset
119   @length = length
120 end

Public Instance Methods

_pcore_init_hash() click to toggle source
Calls superclass method Puppet::Pops::Model::PopsObject#_pcore_init_hash
    # File lib/puppet/pops/model/ast.rb
122 def _pcore_init_hash
123   result = super
124   result['locator'] = @locator
125   result['offset'] = @offset
126   result['length'] = @length
127   result
128 end
file() click to toggle source
    # File lib/puppet/pops/model/ast.rb
103 def file
104   @locator.file
105 end
line() click to toggle source
    # File lib/puppet/pops/model/ast.rb
107 def line
108   @locator.line_for_offset(@offset)
109 end
pos() click to toggle source
    # File lib/puppet/pops/model/ast.rb
111 def pos
112   @locator.pos_on_line(@offset)
113 end