Skip to content

Commit 0e2e80d

Browse files
authored
fix: Update force_encoding to operate on unfrozen string (#60)
Similar to the work done in ccf79af, we are updating this library to handle the upcoming change where strings are frozen by default.
1 parent ffd0ffa commit 0e2e80d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/ld-eventsource/impl/buffered_line_reader.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def self.lines_from(chunks)
2222

2323
Enumerator.new do |gen|
2424
chunks.each do |chunk|
25-
chunk.force_encoding("ASCII-8BIT")
26-
buffer << chunk
25+
chunk = chunk.dup.force_encoding("ASCII-8BIT")
26+
buffer += chunk
2727

2828
loop do
2929
# Search for a line break in any part of the buffer that we haven't yet seen.

0 commit comments

Comments
 (0)