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: 9ccac8b71277
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8e866506d8c5
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jan 28, 2015

  1. Copy the full SHA
    5040d48 View commit details
  2. Merge pull request #2536 from sferik/move_object_methods_to_kernel

    Move #itself and #object_id from Object to Kernel
    headius committed Jan 28, 2015
    Copy the full SHA
    8e86650 View commit details
Showing with 10 additions and 20 deletions.
  1. +10 −0 core/src/main/java/org/jruby/RubyKernel.java
  2. +0 −20 core/src/main/java/org/jruby/RubyObject.java
10 changes: 10 additions & 0 deletions core/src/main/java/org/jruby/RubyKernel.java
Original file line number Diff line number Diff line change
@@ -1948,6 +1948,11 @@ public static RubyBoolean instance_of_p(ThreadContext context, IRubyObject self,
return ((RubyBasicObject)self).instance_of_p(context, type);
}

@JRubyMethod(name = "itself")
public static IRubyObject itself(IRubyObject self) {
return self;
}

@JRubyMethod(name = {"kind_of?", "is_a?"}, required = 1)
public static RubyBoolean kind_of_p(ThreadContext context, IRubyObject self, IRubyObject type) {
return ((RubyBasicObject)self).kind_of_p(context, type);
@@ -1958,6 +1963,11 @@ public static IRubyObject methods19(ThreadContext context, IRubyObject self, IRu
return ((RubyBasicObject)self).methods19(context, args);
}

@JRubyMethod(name = "object_id")
public static IRubyObject object_id(IRubyObject self) {
return self.id();
}

@JRubyMethod(name = "public_methods", optional = 1)
public static IRubyObject public_methods19(ThreadContext context, IRubyObject self, IRubyObject[] args) {
return ((RubyBasicObject)self).public_methods19(context, args);
20 changes: 0 additions & 20 deletions core/src/main/java/org/jruby/RubyObject.java
Original file line number Diff line number Diff line change
@@ -46,7 +46,6 @@
import java.util.Set;

import org.jruby.anno.JRubyClass;
import org.jruby.anno.JRubyMethod;
import org.jruby.runtime.Helpers;
import org.jruby.runtime.Block;
import org.jruby.runtime.ClassIndex;
@@ -321,25 +320,6 @@ public static void puts(Object obj) {
System.out.println(obj.toString());
}

/** rb_obj_id
*
* Return the internal id of an object.
*/
@JRubyMethod(name = "object_id")
@Override
public IRubyObject id() {
return super.id();
}

/** rb_obj_itself
*
* Identity method for the object.
*/
@JRubyMethod
public IRubyObject itself() {
return this;
}

/**
* This method is just a wrapper around the Ruby "==" method,
* provided so that RubyObjects can be used as keys in the Java