public void load(Ruby runtime, boolean wrap) { ThreadContext context = runtime.getCurrentContext(); runtime.getLoadService().require("java"); // load Ruby parts of the 'jruby' library runtime.getLoadService().loadFromClassLoader(runtime.getJRubyClassLoader(), "jruby/jruby.rb", false); // define JRuby module RubyModule jrubyModule = runtime.getOrCreateModule("JRuby"); jrubyModule.defineAnnotatedMethods(JRubyLibrary.class); jrubyModule.defineAnnotatedMethods(JRubyUtilLibrary.class); RubyClass threadLocalClass = jrubyModule.defineClassUnder("ThreadLocal", runtime.getObject(), JRubyThreadLocal.ALLOCATOR); threadLocalClass.defineAnnotatedMethods(JRubyExecutionContextLocal.class); RubyClass fiberLocalClass = jrubyModule.defineClassUnder("FiberLocal", runtime.getObject(), JRubyFiberLocal.ALLOCATOR); fiberLocalClass.defineAnnotatedMethods(JRubyExecutionContextLocal.class); new JRubyConfigLibrary().load(runtime, wrap); }
public void load(Ruby runtime, boolean wrap) { ThreadContext context = runtime.getCurrentContext(); runtime.getLoadService().require("java"); // load Ruby parts of the 'jruby' library runtime.getLoadService().loadFromClassLoader(runtime.getJRubyClassLoader(), "jruby/jruby.rb", false); // define JRuby module RubyModule jrubyModule = runtime.getOrCreateModule("JRuby"); jrubyModule.defineAnnotatedMethods(JRubyLibrary.class); jrubyModule.defineAnnotatedMethods(JRubyUtilLibrary.class); RubyClass threadLocalClass = jrubyModule.defineClassUnder("ThreadLocal", runtime.getObject(), JRubyThreadLocal.ALLOCATOR); threadLocalClass.defineAnnotatedMethods(JRubyExecutionContextLocal.class); RubyClass fiberLocalClass = jrubyModule.defineClassUnder("FiberLocal", runtime.getObject(), JRubyFiberLocal.ALLOCATOR); fiberLocalClass.defineAnnotatedMethods(JRubyExecutionContextLocal.class); new JRubyConfigLibrary().load(runtime, wrap); }
new JRubyConfigLibrary().load(this, false);
new JRubyConfigLibrary().load(this, false);