-
Notifications
You must be signed in to change notification settings - Fork 194
[Ruby 3.0 support] Add category kwarg to Kernel.warn and Warning.warn #2533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Ruby 3.0 support] Add category kwarg to Kernel.warn and Warning.warn #2533
Conversation
4e3c69f
to
170a288
Compare
Calling Could you add a method doing that, under
I can't find what this link points to, can you post the comment in the diff instead? |
Ok, have exactly the same thoughts about unnecessary reads, will adjust the code
It's because it's hidden, oh, here is a file link truffleruby/src/main/ruby/truffleruby/core/kernel.rb Lines 649 to 653 in 9bcfd4f
|
That's a weird corner case when people incorrectly redefine Warning#warn to super into Kernel#warn. |
* Add Symbol check to Warning#[] and Warnign#[]=
170a288
to
85ce09c
Compare
@eregon I've done with all the suggestions (except writing test, since there is one already) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks great! (and sorry for the late review)
* Move specs in the right file, this is behavior of Kernel#warn.
@eregon Oh, finally get what you've meant by old warn support, thanks for adjustments! |
Also, some existing behaviour were ported to other
Warning
methods, like type check inWarning#[]
andWarnign#[]=
In addition, some ruby specs were added ruby/spec#897
Implementation concerns
warn
and[]
, both call the same function which returns internal category value, but not sure that I can reuse it as I did