Class: CodeModels::Artifact
- Inherits:
-
Object
- Object
- CodeModels::Artifact
- Defined in:
- lib/codemodels/artifact.rb
Overview
An artifact is everything that can contain code
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize ⇒ Artifact
constructor
A new instance of Artifact.
-
#point_to_absolute(point) ⇒ Object
The same point specified in respect to the absolute artifact.
-
#position_to_absolute(position) ⇒ Object
The same position specified in respect to the absolute artifact.
Constructor Details
#initialize ⇒ Artifact
10 11 12 |
# File 'lib/codemodels/artifact.rb', line 10 def initialize raise "You should not use Artifact directly" if self.class==Artifact end |
Instance Method Details
#point_to_absolute(point) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/codemodels/artifact.rb', line 16 def point_to_absolute(point) offset = absolute_start p = SourcePoint.new p.line = point.line + offset.line - 1 p.column = point.column p.column += offset.column-1 if point.line==1 p end |
#position_to_absolute(position) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/codemodels/artifact.rb', line 27 def position_to_absolute(position) pos = SourcePosition.new pos.begin_point = point_to_absolute(position.begin_point) pos.end_point = point_to_absolute(position.end_point) pos end |