Skip to content

Commit

Permalink
Update logic for Numeric#step from MRI 2.5. Fixes #5078
Browse files Browse the repository at this point in the history
This includes the following changes:

* Re-port Numeric#step logic and related functions.
* Re-port Numeric#step enumerator size logic.
* Modify ArgsUtil.extractKeywordArgs to use UNDEF instead of nil.
* Update tags for Numeric, Fixnum, Bignum, Integer, Float (no
  changes for last two).
  • Loading branch information
headius committed Apr 12, 2018
1 parent 79e9b26 commit 73808fb
Show file tree
Hide file tree
Showing 7 changed files with 196 additions and 163 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyArray.java
Expand Up @@ -4040,7 +4040,7 @@ public IRubyObject shuffle_bang(ThreadContext context, IRubyObject[] args) {
IRubyObject hash = TypeConverter.checkHashType(context.runtime, args[args.length - 1]);
if (!hash.isNil()) {
IRubyObject[] rets = ArgsUtil.extractKeywordArgs(context, (RubyHash) hash, new String[] { "random" });
if (!rets[0].isNil()) randgen = rets[0];
if (rets[0] != UNDEF) randgen = rets[0];
}
}
int i = realLength;
Expand Down Expand Up @@ -4081,7 +4081,7 @@ public IRubyObject sample(ThreadContext context, IRubyObject[] args) {
IRubyObject hash = TypeConverter.checkHashType(context.runtime, args[args.length - 1]);
if (!hash.isNil()) {
IRubyObject[] rets = ArgsUtil.extractKeywordArgs(context, (RubyHash) hash, new String[] { "random" });
if (!rets[0].isNil()) randgen = rets[0];
if (rets[0] != UNDEF) randgen = rets[0];
args = ArraySupport.newCopy(args, args.length - 1);
}
}
Expand Down

0 comments on commit 73808fb

Please sign in to comment.