lib/io_streams/line/reader.rb in iostreams-1.4.0 vs lib/io_streams/line/reader.rb in iostreams-1.5.0
- old
+ new
@@ -61,14 +61,14 @@
read_block
# Auto-detect windows/linux line endings if not supplied. \n or \r\n
@delimiter ||= auto_detect_line_endings
- if @buffer
- # Change the delimiters encoding to match that of the input stream
- @delimiter = @delimiter.encode(@buffer.encoding)
- @delimiter_size = @delimiter.size
- end
+ return unless @buffer
+
+ # Change the delimiters encoding to match that of the input stream
+ @delimiter = @delimiter.encode(@buffer.encoding)
+ @delimiter_size = @delimiter.size
end
# Iterate over every line in the file/stream passing each line to supplied block in turn.
# Returns [Integer] the number of lines read from the file/stream.
# Note: