Class: XDry::Pos
- Inherits:
-
Object
- Object
- XDry::Pos
- Defined in:
- lib/xdry/parsing/pos.rb
Instance Attribute Summary collapse
-
#file_ref ⇒ Object
readonly
Returns the value of attribute file_ref.
-
#line_no ⇒ Object
readonly
Returns the value of attribute line_no.
-
#scope_after ⇒ Object
Returns the value of attribute scope_after.
-
#scope_before ⇒ Object
Returns the value of attribute scope_before.
Instance Method Summary collapse
- #file_path ⇒ Object
- #fixup!(after_line_no, offset) ⇒ Object
-
#initialize(file_ref, line_no) ⇒ Pos
constructor
A new instance of Pos.
- #to_s ⇒ Object
Constructor Details
#initialize(file_ref, line_no) ⇒ Pos
Returns a new instance of Pos.
54 55 56 57 58 |
# File 'lib/xdry/parsing/pos.rb', line 54 def initialize file_ref, line_no @file_ref = file_ref @line_no = line_no @file_ref.add_pos! self end |
Instance Attribute Details
#file_ref ⇒ Object (readonly)
Returns the value of attribute file_ref.
51 52 53 |
# File 'lib/xdry/parsing/pos.rb', line 51 def file_ref @file_ref end |
#line_no ⇒ Object (readonly)
Returns the value of attribute line_no.
51 52 53 |
# File 'lib/xdry/parsing/pos.rb', line 51 def line_no @line_no end |
#scope_after ⇒ Object
Returns the value of attribute scope_after.
52 53 54 |
# File 'lib/xdry/parsing/pos.rb', line 52 def scope_after @scope_after end |
#scope_before ⇒ Object
Returns the value of attribute scope_before.
52 53 54 |
# File 'lib/xdry/parsing/pos.rb', line 52 def scope_before @scope_before end |
Instance Method Details
#file_path ⇒ Object
60 61 62 |
# File 'lib/xdry/parsing/pos.rb', line 60 def file_path @file_ref.path end |
#fixup!(after_line_no, offset) ⇒ Object
64 65 66 67 68 |
# File 'lib/xdry/parsing/pos.rb', line 64 def fixup! after_line_no, offset if @line_no > after_line_no @line_no += offset end end |
#to_s ⇒ Object
70 71 72 |
# File 'lib/xdry/parsing/pos.rb', line 70 def to_s "#{File.basename(@file_ref.path)}:#{@line_no}" end |