From b3cdfeddbd8e2b0f4bedfb8eed5306933d005dd2 Mon Sep 17 00:00:00 2001 From: thomas morgan Date: Thu, 5 Dec 2024 10:01:09 -0700 Subject: [PATCH] fix deprecation warning fixes warning: gems/zstd-ruby-1.5.6.6/lib/zstd-ruby/stream_writer.rb:6: warning: `level` in args is deprecated; use keyword args `level:` instead. --- lib/zstd-ruby/stream_writer.rb | 2 +- spec/zstd-ruby-stream_writer_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/zstd-ruby/stream_writer.rb b/lib/zstd-ruby/stream_writer.rb index 3e379bf..78ac4db 100644 --- a/lib/zstd-ruby/stream_writer.rb +++ b/lib/zstd-ruby/stream_writer.rb @@ -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) diff --git a/spec/zstd-ruby-stream_writer_spec.rb b/spec/zstd-ruby-stream_writer_spec.rb index 369aab5..3c555fb 100644 --- a/spec/zstd-ruby-stream_writer_spec.rb +++ b/spec/zstd-ruby-stream_writer_spec.rb @@ -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