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
51 def self._pcore_type
52   @_pcore_type ||= Types::PObjectType.new('Puppet::AST::Positioned', {
53     'parent' => PopsObject._pcore_type,
54     'attributes' => {
55       'locator' => {
56         'type' => Parser::Locator::Locator19._pcore_type,
57         'kind' => 'reference'
58       },
59       'offset' => Types::PIntegerType::DEFAULT,
60       'length' => Types::PIntegerType::DEFAULT,
61       'file' => {
62         'type' => Types::PStringType::DEFAULT,
63         'kind' => 'derived'
64       },
65       'line' => {
66         'type' => Types::PIntegerType::DEFAULT,
67         'kind' => 'derived'
68       },
69       'pos' => {
70         'type' => Types::PIntegerType::DEFAULT,
71         'kind' => 'derived'
72       }
73     },
74     'equality' => []
75   })
76 end
create(locator, offset, length) click to toggle source
   # File lib/puppet/pops/model/ast.rb
89 def self.create(locator, offset, length)
90   ta = Types::TypeAsserter
91   attrs = _pcore_type.attributes(true)
92   ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator)
93   ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset)
94   ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length)
95   new(locator, offset, length)
96 end
from_asserted_hash(init_hash) click to toggle source
   # File lib/puppet/pops/model/ast.rb
82 def self.from_asserted_hash(init_hash)
83   new(
84     init_hash['locator'],
85     init_hash['offset'],
86     init_hash['length'])
87 end
from_hash(init_hash) click to toggle source
   # File lib/puppet/pops/model/ast.rb
78 def self.from_hash(init_hash)
79   from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::Positioned initializer', _pcore_type.init_hash_type, init_hash))
80 end
new(locator, offset, length) click to toggle source
Calls superclass method Puppet::Pops::Model::PopsObject::new
    # File lib/puppet/pops/model/ast.rb
114 def initialize(locator, offset, length)
115   super()
116   @locator = locator
117   @offset = offset
118   @length = length
119 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
121 def _pcore_init_hash
122   result = super
123   result['locator'] = @locator
124   result['offset'] = @offset
125   result['length'] = @length
126   result
127 end
file() click to toggle source
    # File lib/puppet/pops/model/ast.rb
102 def file
103   @locator.file
104 end
line() click to toggle source
    # File lib/puppet/pops/model/ast.rb
106 def line
107   @locator.line_for_offset(@offset)
108 end
pos() click to toggle source
    # File lib/puppet/pops/model/ast.rb
110 def pos
111   @locator.pos_on_line(@offset)
112 end