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 2.4] Implemented Integer#digits #4375
Conversation
It passes all the following tests of TestInteger of MRI: * test_digits * test_digits_for_negative_numbers * test_digits_for_invalid_base_numbers * test_digits_for_non_integral_base_numbers * test_digits_for_non_numeric_base_argument
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 think for RubyBignum instances you will need to have two code paths here. I would even break those out and put the implementation in RubyFixnum and RubyBignum.
|
||
@JRubyMethod(name = "digits") | ||
public RubyArray digits(ThreadContext context, IRubyObject base) { | ||
long self = ((RubyFixnum)this).getLongValue(); |
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.
Is this guanteed to be an instance of RubyFixnum? It can also be a RubyBignum.
I don't expect to have a chance to fix this in the next two weeks. If someone wants to finish this: be my guest. Otherwise, it might have to wait a little bit |
I've written a fix for this issue, however I've never contributed to someone else's pull request. I assume I submit a pull request to @herwinw's repository? |
@whwilder that assumes he will than manage the PR out. and since this is stale for 2 months now ... |
Yeah, like @kares said, it may be best to just create a new PR based on this one. Github doesn't have a great way for two people in two repos to collaborate on a single PR. |
This is continued in #4490, no need to keep this PR opened |
* [ruby 2.4] Implemented Integer#digits It passes all the following tests of TestInteger of MRI: * test_digits * test_digits_for_negative_numbers * test_digits_for_invalid_base_numbers * test_digits_for_non_integral_base_numbers * test_digits_for_non_numeric_base_argument * Moved Integer#digits to Fixnum & Bignum * Fixed some styling issues
It passes all the following tests of TestInteger of MRI: