| Class | CSV::IOReader |
| In: |
lib/csv.rb
|
| Parent: | Reader |
# File lib/csv.rb, line 616
616: def initialize(io, fs = ',', rs = nil)
617: @io = io
618: @fs = fs
619: @rs = rs
620: @dev = CSV::IOBuf.new(@io)
621: @idx = 0
622: if @dev[0] == 0xef and @dev[1] == 0xbb and @dev[2] == 0xbf
623: @idx += 3
624: end
625: @close_on_terminate = false
626: end
# File lib/csv.rb, line 636
636: def get_row(row)
637: parsed_cells, next_idx = CSV.parse_row(@dev, @idx, row, @fs, @rs)
638: if parsed_cells == 0 and next_idx == 0 and !@dev.is_eos?
639: raise IllegalFormatError.new
640: end
641: dropped = @dev.drop(next_idx)
642: @idx = next_idx - dropped
643: parsed_cells
644: end