Skip to content

Instantly share code, notes, and snippets.

@yorickpeterse
Created January 25, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorickpeterse/df4b33859869d26c4cf7 to your computer and use it in GitHub Desktop.
Save yorickpeterse/df4b33859869d26c4cf7 to your computer and use it in GitHub Desktop.
package org.libll;
import org.jruby.Ruby;
import org.jruby.RubyModule;
import org.jruby.RubyClass;
import org.jruby.RubyObject;
import org.jruby.RubyArray;
import org.jruby.anno.JRubyClass;
import org.jruby.anno.JRubyMethod;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.builtin.IRubyObject;
@JRubyClass(name="LL::DriverConfig", parent="Object")
public class DriverConfig extends RubyObject
{
private Ruby runtime;
/**
* Sets up the class in the Ruby runtime.
*/
public static void load(Ruby runtime)
{
RubyModule ll = (RubyModule) runtime.getModule("LL");
RubyClass config = ll.defineClassUnder(
"DriverConfig",
runtime.getObject(),
ALLOCATOR
);
config.defineAnnotatedMethods(DriverConfig.class);
}
private static final ObjectAllocator ALLOCATOR = new ObjectAllocator()
{
public IRubyObject allocate(Ruby runtime, RubyClass klass)
{
return new org.libll.DriverConfig(runtime, klass);
}
};
public DriverConfig(Ruby runtime, RubyClass klass)
{
super(runtime, klass);
this.runtime = runtime;
}
@JRubyMethod(name="tokens_native=")
public IRubyObject set_tokens_native(ThreadContext context, RubyArray array)
{
return context.nil;
}
@JRubyMethod(name="rules_native=")
public IRubyObject set_rules_native(ThreadContext context, RubyArray array)
{
return context.nil;
}
@JRubyMethod(name="table_native=")
public IRubyObject set_table_native(ThreadContext context, RubyArray array)
{
return context.nil;
}
@JRubyMethod(name="actions_native=")
public IRubyObject set_actions_native(ThreadContext context, RubyArray array)
{
return context.nil;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment