Class: AsciiDoc::AsciiLines

Inherits:
Object
  • Object
show all
Defined in:
lib/asciidoc/asciilines.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ AsciiLines

Returns a new instance of AsciiLines.



7
8
9
10
# File 'lib/asciidoc/asciilines.rb', line 7

def initialize(content)
  @current_index = 0
  @lines = content.gsub("\r","").split("\n")
end

Instance Attribute Details

#current_indexObject

Returns the value of attribute current_index.



5
6
7
# File 'lib/asciidoc/asciilines.rb', line 5

def current_index
  @current_index
end

#linesObject

Returns the value of attribute lines.



5
6
7
# File 'lib/asciidoc/asciilines.rb', line 5

def lines
  @lines
end

Instance Method Details

#current_lineObject



25
26
27
# File 'lib/asciidoc/asciilines.rb', line 25

def current_line
  @lines[@current_index]
end

#next_lineObject



21
22
23
# File 'lib/asciidoc/asciilines.rb', line 21

def next_line
  @lines[@current_index + 1]
end

#prev_lineObject



17
18
19
# File 'lib/asciidoc/asciilines.rb', line 17

def prev_line
  @lines[@current_index - 1]
end

#shift_lineObject



12
13
14
15
# File 'lib/asciidoc/asciilines.rb', line 12

def shift_line
  @current_index += 1
  current_line
end