mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
Make Warning.warn accept only category keyword
In general accepting arbitrary keywords is a bad idea unless you are delegating keywords or acting on arbitrary keywords. In this case, the category keyword is ignored, and it's less error prone to not ignore all keywords.
This commit is contained in:
parent
5d7953f86b
commit
92c3ad9c27
Notes:
git
2020-09-29 00:38:31 +09:00
2 changed files with 9 additions and 4 deletions
|
@ -925,8 +925,8 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||
remove_method :warn
|
||||
|
||||
if category
|
||||
define_method(:warn) do |str, **kw|
|
||||
warning << [str, kw[:category]]
|
||||
define_method(:warn) do |str, category: nil|
|
||||
warning << [str, category]
|
||||
end
|
||||
else
|
||||
define_method(:warn) do |str|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue