Commit 8bbee83
authored
Make Zlib::GzipWriter.new level and strategy parameters optional
The current signature requires all three positional arguments:
def initialize: (_Writer io, Integer level, Integer strategy, **untyped opts) -> void
However, the Ruby documentation and actual C implementation show that
both level and strategy have default values (nil), making them optional:
Zlib::GzipWriter.new(io, level = nil, strategy = nil, options = {})
The documentation examples also demonstrate calling with just io:
File.open('hoge.gz', 'w') do |f|
gz = Zlib::GzipWriter.new(f)
gz.write 'jugemu jugemu gokou no surikire...'
gz.close
end
This change updates the signature to allow 1-4 arguments by making
level and strategy optional nilable parameters:
def initialize: (_Writer io, ?Integer? level, ?Integer? strategy, **untyped opts) -> void
This matches the actual Ruby behavior and resolves false positive type
errors when calling GzipWriter.new with fewer than three arguments.1 parent 9871d32 commit 8bbee83
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
0 commit comments