lib/impls/reader_strbuf.rb in bychar-2.0.0 vs lib/impls/reader_strbuf.rb in bychar-3.0.0

- old
+ new

@@ -12,13 +12,14 @@ end # Will transparently read one byte off the contained IO, maintaining the internal cache. # If the cache has been depleted it will read a big chunk from the IO and cache it and then # return the byte - def read_one_char! + def read_one_char if @pos_in_buf > @maximum_pos @buf = @io.read(DEFAULT_BUFFER_SIZE) - raise EOF if @buf.nil? + + return nil if @buf.nil? @maximum_pos = @buf.length - 1 @pos_in_buf = 0 end \ No newline at end of file