Class: Glark::IO::LinesNonCR
Constant Summary collapse
- ANY_END_OF_LINE =
cross-platform end of line: DOS UNIX MAC
Regexp.new '(?:\r\n|\n|\r)'
Instance Method Summary collapse
- #each_line(&blk) ⇒ Object
-
#get_lines ⇒ Object
Returns the lines for this file, separated by end of line sequences.
-
#get_region(rnum) ⇒ Object
returns the region/range that is represented by the region number.
-
#initialize(fname, io) ⇒ LinesNonCR
constructor
A new instance of LinesNonCR.
Methods inherited from Lines
Constructor Details
#initialize(fname, io) ⇒ LinesNonCR
Returns a new instance of LinesNonCR.
59 60 61 62 63 64 |
# File 'lib/glark/util/io/lines.rb', line 59 def initialize fname, io super fname @extracted = nil @regions = nil @lines = ::IO::readlines fname end |
Instance Method Details
#each_line(&blk) ⇒ Object
66 67 68 69 70 |
# File 'lib/glark/util/io/lines.rb', line 66 def each_line &blk @lines.each do |line| blk.call line end end |
#get_lines ⇒ Object
Returns the lines for this file, separated by end of line sequences.
73 74 75 |
# File 'lib/glark/util/io/lines.rb', line 73 def get_lines @extracted ||= create_extracted end |
#get_region(rnum) ⇒ Object
returns the region/range that is represented by the region number
78 79 80 81 |
# File 'lib/glark/util/io/lines.rb', line 78 def get_region rnum @regions ||= create_regions @regions[rnum] end |