Class: AsciiDoc::AsciiLines
- Inherits:
-
Object
- Object
- AsciiDoc::AsciiLines
- Defined in:
- lib/asciidoc/asciilines.rb
Instance Attribute Summary collapse
-
#current_index ⇒ Object
Returns the value of attribute current_index.
-
#lines ⇒ Object
Returns the value of attribute lines.
Instance Method Summary collapse
- #current_line ⇒ Object
-
#initialize(content) ⇒ AsciiLines
constructor
A new instance of AsciiLines.
- #next_line ⇒ Object
- #prev_line ⇒ Object
- #shift_line ⇒ Object
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_index ⇒ Object
Returns the value of attribute current_index.
5 6 7 |
# File 'lib/asciidoc/asciilines.rb', line 5 def current_index @current_index end |
#lines ⇒ Object
Returns the value of attribute lines.
5 6 7 |
# File 'lib/asciidoc/asciilines.rb', line 5 def lines @lines end |
Instance Method Details
#current_line ⇒ Object
25 26 27 |
# File 'lib/asciidoc/asciilines.rb', line 25 def current_line @lines[@current_index] end |
#next_line ⇒ Object
21 22 23 |
# File 'lib/asciidoc/asciilines.rb', line 21 def next_line @lines[@current_index + 1] end |
#prev_line ⇒ Object
17 18 19 |
# File 'lib/asciidoc/asciilines.rb', line 17 def prev_line @lines[@current_index - 1] end |
#shift_line ⇒ Object
12 13 14 15 |
# File 'lib/asciidoc/asciilines.rb', line 12 def shift_line @current_index += 1 current_line end |