Class: Asciidoctor::Reader::Cursor

Inherits:
Object
  • Object
show all
Defined in:
lib/asciidoctor/reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, dir = nil, path = nil, lineno = 1) ⇒ Cursor

Returns a new instance of Cursor.



10
11
12
# File 'lib/asciidoctor/reader.rb', line 10

def initialize file, dir = nil, path = nil, lineno = 1
  @file, @dir, @path, @lineno = file, dir, path, lineno
end

Instance Attribute Details

#dirObject (readonly)



8
9
10
# File 'lib/asciidoctor/reader.rb', line 8

def dir
  @dir
end

#fileObject (readonly)



8
9
10
# File 'lib/asciidoctor/reader.rb', line 8

def file
  @file
end

#linenoObject (readonly)



8
9
10
# File 'lib/asciidoctor/reader.rb', line 8

def lineno
  @lineno
end

#pathObject (readonly)



8
9
10
# File 'lib/asciidoctor/reader.rb', line 8

def path
  @path
end

Instance Method Details

#advance(num) ⇒ Object



14
15
16
# File 'lib/asciidoctor/reader.rb', line 14

def advance num
  @lineno += num
end

#line_infoObject Also known as: to_s



18
19
20
# File 'lib/asciidoctor/reader.rb', line 18

def line_info
  %(#{@path}: line #{@lineno})
end