drop a string from the stream.
returns dropped size. at EOF, dropped size might not equals to arg n. Once
you drop the head of the stream,
access to the dropped part via [] or get returns nil.
# File lib/csv.rb, line 854
def drop(n)
if is_eos?
return 0
end
size_dropped = 0
while (n > 0)
if !@is_eos or (@cur_buf != @buf_tail_idx)
if (@offset + n < buf_size(@cur_buf))
size_dropped += n
@offset += n
n = 0
else
size = buf_size(@cur_buf) - @offset
size_dropped += size
n -= size
@offset = 0
unless rel_buf
unless add_buf
break
end
@cur_buf = @buf_tail_idx
end
end
end
end
size_dropped
end