-
Notifications
You must be signed in to change notification settings - Fork 188
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
Remove deprecated methods #3432
Remove deprecated methods #3432
Conversation
f1fdda7
to
02c829c
Compare
02c829c
to
69b3236
Compare
r = self =~ other ? false : true | ||
r = nil ? false : true |
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.
i thought using nil
here would make sense since =~
returns nil; would it be better to just return true?
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.
=~
returned nil
as the default implementation. But, if a class defines =~
then !~
will call that version. You can see the dynamic call in CRuby:
https://github.com/ruby/ruby/blob/7b93e65e9f9cb7abfc7e19aff4da9d6e4c32de4b/object.c#L1629-L1634
As an example:
class X
def =~(other)
puts :hi
end
end
X.new !~ "abc"
That will print out 'hi' because !~
delegates to =~
.
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.
ohh i see thanks; i used respond_to
to check for an implantation, is there a better approach?
69b3236
to
764f883
Compare
Co-authored-by: Kevin Menard <kevin.menard@shopify.com>
@andrykonchin already has a PR for this in #3444, he will try to rebase his PR on top of this one. |
Part of #3039
Remove deprecated methods:
Dir.exists?
File.exists?
Kernel#=~