Skip to content
This repository was archived by the owner on Aug 29, 2024. It is now read-only.

Commit bcf5185

Browse files
authored
Prefer String#slice for better compatibility. Fixes #72. (#75)
1 parent f451a33 commit bcf5185

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/async/io/stream.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def peek(size = nil)
134134
# Don't read less than @block_size to avoid lots of small reads:
135135
fill_read_buffer(read_size > @block_size ? read_size : @block_size)
136136
end
137-
return @read_buffer[..([size, @read_buffer.size].min - 1)]
137+
return @read_buffer.slice(0, [size, @read_buffer.size].min)
138138
end
139139
until (block_given? && yield(@read_buffer)) or @eof
140140
fill_read_buffer

0 commit comments

Comments
 (0)