class
Crst::LineReader
- Crst::LineReader
- Reference
- Object
Overview
Helper class for iterating over lines of text
Defined in:
crst/line_reader.crConstructors
Instance Method Summary
-
#advance(count : Int32 = 1)
Advance the reader by count lines
-
#consume_until(&) : Array(String)
Consume lines until the block returns true (or EOF) The line that satisfies the condition is NOT consumed Returns the consumed lines
-
#current : String
Returns the current line Raises IndexError if out of bounds
-
#current? : String | Nil
Returns the current line or nil if out of bounds
-
#eof?
Check if the reader is at the end
-
#has_next?
Check if there are more lines to read
- #index : Int32
- #lines : Array(String)
-
#peek(offset : Int32 = 1) : String | Nil
Returns the line at offset from current position peek(1) is the next line
-
#skip_empty_lines
Skip empty lines
-
#slice(start_index : Int32) : Array(String)
Returns a slice of lines from start (inclusive) to current (exclusive)
Constructor Detail
Instance Method Detail
Consume lines until the block returns true (or EOF) The line that satisfies the condition is NOT consumed Returns the consumed lines
Returns the line at offset from current position peek(1) is the next line
Returns a slice of lines from start (inclusive) to current (exclusive)