-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
returns String instances when called on a subclass in Ruby 3.0.0 #851
returns String instances when called on a subclass in Ruby 3.0.0 #851
Conversation
Yes, this looks good 👍 |
1faf27d
to
9c8f9ec
Compare
439aaa7
to
9e6f708
Compare
Thank you for your feedback! I have added the tests for these methods:
I am looking forward to receiving your review. However... I observed a few things that I'd like to share. May be you have some comments for them. Destructive methods (still) return subclassAll destructive methods that return # ruby-3.0.1
class MyString < String; end;
MyString.new(" hello").lstrip!.class # => MyString
MyString.new("hello ").rstrip!.class # => MyString
MyString.new(" hello ").strip!.class # => MyString
MyString.new("123").slice(1, 2).class # => String I assume this is expected, except for Mixed classes in return array for
|
Destructive methods typically return self or nil if no change, so of course the subclass is kept. Re partition yeah it makes sense to me at least. Re scrub yeah sounds good as you did. |
Looks great, could you adapt the guards to all use |
Thank you for the PR! |
@eregon Thank you a lot, I will keep your feedback about the version guards in mind for future PR! 👍 |
Hello 👋
I hope I am getting this right. While looking through #823 I realized that some specs are not implemented for
Here's what I think is implemented/missing:
This PR currently adds the tests for
String#lstrip
, but I'd like to proceed and add the tests for the remaining methods in the list.Before I do that, I'd like to ask you if my list is correct or if I overlook something?
Thanks a lot for your feedback and assistance.