Skip to content
This repository was archived by the owner on Aug 29, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/async/io/stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def peek(size = nil)
# Don't read less than @block_size to avoid lots of small reads:
fill_read_buffer(read_size > @block_size ? read_size : @block_size)
end
return @read_buffer[..([size, @read_buffer.size].min - 1)]
return @read_buffer.slice(0, [size, @read_buffer.size].min)
end
until (block_given? && yield(@read_buffer)) or @eof
fill_read_buffer
Expand Down