Sha256: 12093b3abbff6188ae1554c5f52b8354a85617b9196693bd811acb38871acbba

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

package sandbox;

import java.io.IOException;

import org.jruby.Ruby;
import org.jruby.RubyClass;
import org.jruby.RubyModule;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.load.BasicLibraryService;

public class SandboxService implements BasicLibraryService {
  public boolean basicLoad(Ruby runtime) throws IOException {
    init(runtime);
    return true;
  }

  private void init(Ruby runtime) {
    RubyModule mSandbox = runtime.defineModule("Sandbox");
    mSandbox.defineAnnotatedMethods(SandboxModule.class);

    RubyClass cSandboxFull = mSandbox.defineClassUnder("Full", runtime.getObject(), FULL_ALLOCATOR);
    cSandboxFull.defineAnnotatedMethods(SandboxFull.class);

    RubyClass cSandboxException = mSandbox.defineClassUnder("SandboxException", runtime.getException(), runtime.getException().getAllocator());
  }

  protected static final ObjectAllocator FULL_ALLOCATOR = new ObjectAllocator() {
    public IRubyObject allocate(Ruby runtime, RubyClass klass) {
      return new SandboxFull(runtime, klass);
    }
  };
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jruby_sandbox-0.2.2-java ext/java/sandbox/SandboxService.java
jruby_sandbox-0.2.1-java ext/java/sandbox/SandboxService.java
jruby_sandbox-0.2.0-java ext/java/sandbox/SandboxService.java
jruby_sandbox-0.1.4-java ext/java/sandbox/SandboxService.java
jruby_sandbox-0.1.3-java ext/java/sandbox/SandboxService.java
jruby_sandbox-0.1.2-java ext/java/sandbox/SandboxService.java
jruby_sandbox-0.1.1-java ext/java/sandbox/SandboxService.java
jruby_sandbox-0.1.0-java ext/java/sandbox/SandboxService.java