Sha256: 0fb100c89bca5b9f53ead84c79e1a7726dde29f913b3eb7a07fbd8d3b0ff273e

Contents?: true

Size: 1.22 KB

Versions: 8

Compression:

Stored size: 1.22 KB

Contents

package sandbox;

import org.jruby.Ruby;
import org.jruby.RubyClass;
import org.jruby.anno.JRubyClass;
import org.jruby.anno.JRubyMethod;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.Block;

@JRubyClass(name="BoxedClass")
public class BoxedClass {
  protected static RubyClass createBoxedClassClass(final Ruby runtime) {
    RubyClass cObject = runtime.getObject();
    RubyClass cBoxedClass = runtime.defineClass("BoxedClass", cObject, cObject.getAllocator());
    cBoxedClass.defineAnnotatedMethods(BoxedClass.class);

    return cBoxedClass;
  }

  @JRubyMethod(module=true, rest=true)
  public static IRubyObject method_missing(IRubyObject recv, IRubyObject[] args, Block block) {
    IRubyObject[] args2 = new IRubyObject[args.length - 1];
    System.arraycopy(args, 1, args2, 0, args2.length);
    String name = args[0].toString();

    SandboxFull box = (SandboxFull) SandboxFull.getLinkedBox(recv);
    return box.runMethod(recv, name, args2, block);
  }

  @JRubyMethod(name="new", meta=true, rest=true)
  public static IRubyObject _new(IRubyObject recv, IRubyObject[] args, Block block) {
    SandboxFull box = (SandboxFull) SandboxFull.getLinkedBox(recv);
    return box.runMethod(recv, "new", args, block);
  }
}

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
xplenty-jruby_sandbox-0.2.9-java ext/java/sandbox/BoxedClass.java
xplenty-jruby_sandbox-0.2.8-java ext/java/sandbox/BoxedClass.java
xplenty-jruby_sandbox-0.2.7-java ext/java/sandbox/BoxedClass.java
xplenty-jruby_sandbox-0.2.6-java ext/java/sandbox/BoxedClass.java
xplenty-jruby_sandbox-0.2.5-java ext/java/sandbox/BoxedClass.java
xplenty-jruby_sandbox-0.2.4-java ext/java/sandbox/BoxedClass.java
jruby_sandbox-0.2.3-java ext/java/sandbox/BoxedClass.java
jruby-safe-0.2.2-java ext/java/sandbox/BoxedClass.java