Skip to content

Commit

Permalink
Merge pull request #96 from zarqman/fix-deprecation-warning
Browse files Browse the repository at this point in the history
Fix deprecation warning in StreamWriter
  • Loading branch information
SpringMT authored Dec 10, 2024
2 parents 2b99d40 + b3cdfed commit 8a645dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/zstd-ruby/stream_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Zstd
class StreamWriter
def initialize(io, level: nil)
@io = io
@stream = Zstd::StreamingCompress.new(level)
@stream = Zstd::StreamingCompress.new(level: level)
end

def write(*data)
Expand Down
10 changes: 10 additions & 0 deletions spec/zstd-ruby-stream_writer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,14 @@
expect(Zstd.decompress(io.read)).to eq('abcdef')
end
end
describe 'level' do
it 'should work' do
io = StringIO.new
stream = Zstd::StreamWriter.new(io, level: 5)
stream.write("abcdef")
stream.finish
io.rewind
expect(Zstd.decompress(io.read)).to eq('abcdef')
end
end
end

0 comments on commit 8a645dc

Please sign in to comment.