Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 516792fca582
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c051b56abc8d
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Nov 25, 2015

  1. Copy the full SHA
    e056236 View commit details

Commits on Dec 1, 2015

  1. Merge pull request #3497 from lucasallan/negative-positive-numeric

    [Ruby-2.3] - Implements Numeric#positive? and Numeric#negative?
    enebo committed Dec 1, 2015
    Copy the full SHA
    c051b56 View commit details
Showing with 18 additions and 0 deletions.
  1. +18 −0 core/src/main/java/org/jruby/RubyNumeric.java
18 changes: 18 additions & 0 deletions core/src/main/java/org/jruby/RubyNumeric.java
Original file line number Diff line number Diff line change
@@ -1241,4 +1241,22 @@ public Throwable fillInStackTrace() {
public static RubyFloat str2fnum19(Ruby runtime, RubyString arg, boolean strict) {
return str2fnumCommon(runtime, arg, strict, biteListCaller19);
}

/** num_negative_p
*
*/
@JRubyMethod(name = "negative?")
public IRubyObject isNegative(ThreadContext context) {
IRubyObject zero = convertToNum(0, context.runtime);
return callMethod(context, "<", zero);

}
/** num_positive_p
*
*/
@JRubyMethod(name = "positive?")
public IRubyObject isPositive(ThreadContext context) {
IRubyObject zero = convertToNum(0, context.runtime);
return callMethod(context, ">", zero);
}
}