@Override public boolean basicLoad(Ruby ruby) throws IOException { ruby.defineModule("Google"); RubyProtobuf.createProtobuf(ruby); RubyDescriptor.createRubyDescriptor(ruby); RubyBuilder.createRubyBuilder(ruby); RubyFieldDescriptor.createRubyFileDescriptor(ruby); RubyMessageBuilderContext.createRubyMessageBuilderContext(ruby); RubyEnumDescriptor.createRubyEnumDescriptor(ruby); RubyEnumBuilderContext.createRubyEnumBuilderContext(ruby); RubyDescriptorPool.createRubyDescriptorPool(ruby); RubyRepeatedField.createRubyRepeatedField(ruby); RubyFieldDescriptor.createRubyFileDescriptor(ruby); RubyMap.createRubyMap(ruby); RubyOneofDescriptor.createRubyOneofDescriptor(ruby); RubyOneofBuilderContext.createRubyOneofBuilderContext(ruby); return true; } }
public static RubyModule createJavaArrayUtilitiesModule(Ruby runtime) { RubyModule javaArrayUtils = runtime.defineModule("JavaArrayUtilities"); javaArrayUtils.defineAnnotatedMethods(JavaArrayUtilities.class); return javaArrayUtils; }
public static RubyModule createJavaProxyMethods(ThreadContext context) { RubyModule JavaProxyMethods = context.runtime.defineModule("JavaProxyMethods"); JavaProxyMethods.defineAnnotatedMethods(JavaProxyMethods.class); return JavaProxyMethods; }
public void load(Ruby runtime, boolean wrap) { RubyModule coverage = runtime.defineModule("Coverage"); coverage.defineAnnotatedMethods(CoverageModule.class); } }
import org.jruby.Ruby; import org.jruby.RubyModule; import org.jruby.runtime.load.BasicLibraryService; import java.io.IOException; public class GreeterService implements BasicLibraryService { @Override public boolean basicLoad(final Ruby runtime) throws IOException { RubyModule greeter = runtime.defineModule(Greeter.class.getSimpleName()); greeter.defineAnnotatedMethods(Greeter.class); return true; } }
public static RubyModule createEnumerableModule(Ruby runtime) { RubyModule enumModule = runtime.defineModule("Enumerable"); runtime.setEnumerable(enumModule); enumModule.defineAnnotatedMethods(RubyEnumerable.class); return enumModule; }
public static RubyModule createFileTestModule(Ruby runtime) { RubyModule fileTestModule = runtime.defineModule("FileTest"); runtime.setFileTest(fileTestModule); fileTestModule.defineAnnotatedMethods(RubyFileTest.class); return fileTestModule; }
public static RubyModule createGCModule(Ruby runtime) { RubyModule result = runtime.defineModule("GC"); runtime.setGC(result); result.defineAnnotatedMethods(RubyGC.class); return result; }
public static RubyModule createEnumerableModule(Ruby runtime) { RubyModule enumModule = runtime.defineModule("Enumerable"); runtime.setEnumerable(enumModule); enumModule.defineAnnotatedMethods(RubyEnumerable.class); return enumModule; }
public static RubyModule createFileTestModule(Ruby runtime) { RubyModule fileTestModule = runtime.defineModule("FileTest"); runtime.setFileTest(fileTestModule); fileTestModule.defineAnnotatedMethods(RubyFileTest.class); return fileTestModule; }
public static RubyModule createComparable(Ruby runtime) { RubyModule comparableModule = runtime.defineModule("Comparable"); runtime.setComparable(comparableModule); comparableModule.defineAnnotatedMethods(RubyComparable.class); return comparableModule; }
public static RubyModule createWarningModule(Ruby runtime) { RubyModule warning = runtime.defineModule("Warning"); warning.defineAnnotatedMethods(RubyWarnings.class); warning.extend_object(warning); runtime.setWarning(warning); return warning; }
public void load(final Ruby runtime, boolean wrap) throws IOException { RubyModule mFcntl = runtime.defineModule("Fcntl"); runtime.loadConstantSet(mFcntl, "Fcntl"); runtime.loadConstantSet(mFcntl, "OpenFlags"); mFcntl.defineConstant("FD_CLOEXEC", RubyFixnum.newFixnum(runtime, FD_CLOEXEC)); } }
public static RubyModule createJavaInterfaceTemplateModule(ThreadContext context) { final Ruby runtime = context.runtime; RubyModule JavaInterfaceTemplate = runtime.defineModule("JavaInterfaceTemplate"); RubyClass singleton = JavaInterfaceTemplate.getSingletonClass(); singleton.addReadAttribute(context, "java_class"); singleton.defineAnnotatedMethods(JavaInterfaceTemplate.class); JavaInterfaceTemplate.defineAnnotatedMethods(JavaProxy.ClassMethods.class); return JavaInterfaceTemplate; }
/** Create the ObjectSpace module and add it to the Ruby runtime. * */ public static RubyModule createObjectSpaceModule(Ruby runtime) { RubyModule objectSpaceModule = runtime.defineModule("ObjectSpace"); runtime.setObjectSpaceModule(objectSpaceModule); objectSpaceModule.defineAnnotatedMethods(RubyObjectSpace.class); if (runtime.is2_0()) { WeakMap.createWeakMap(runtime); } return objectSpaceModule; }
public void load(final Ruby runtime, boolean wrap) throws IOException { RubyModule mFcntl = runtime.defineModule("Fcntl"); runtime.loadConstantSet(mFcntl, "Fcntl"); runtime.loadConstantSet(mFcntl, "OpenFlags"); mFcntl.defineConstant("FD_CLOEXEC", RubyFixnum.newFixnum(runtime, FD_CLOEXEC)); } }
/** Create the Math module and add it to the Ruby runtime. * */ public static RubyModule createMathModule(Ruby runtime) { RubyModule result = runtime.defineModule("Math"); runtime.setMath(result); result.defineConstant("E", RubyFloat.newFloat(runtime, Math.E)); result.defineConstant("PI", RubyFloat.newFloat(runtime, Math.PI)); result.defineAnnotatedMethods(RubyMath.class); return result; }
public static RubyModule createMarshalModule(Ruby runtime) { RubyModule module = runtime.defineModule("Marshal"); runtime.setMarshal(module); module.defineAnnotatedMethods(RubyMarshal.class); module.defineConstant("MAJOR_VERSION", runtime.newFixnum(Constants.MARSHAL_MAJOR)); module.defineConstant("MINOR_VERSION", runtime.newFixnum(Constants.MARSHAL_MINOR)); return module; }
public static RubyModule createMarshalModule(Ruby runtime) { RubyModule module = runtime.defineModule("Marshal"); runtime.setMarshal(module); module.defineAnnotatedMethods(RubyMarshal.class); module.defineConstant("MAJOR_VERSION", runtime.newFixnum(Constants.MARSHAL_MAJOR)); module.defineConstant("MINOR_VERSION", runtime.newFixnum(Constants.MARSHAL_MINOR)); return module; }
/** Create the Math module and add it to the Ruby runtime. * */ public static RubyModule createMathModule(Ruby runtime) { RubyModule result = runtime.defineModule("Math"); runtime.setMath(result); result.defineConstant("E", RubyFloat.newFloat(runtime, Math.E)); result.defineConstant("PI", RubyFloat.newFloat(runtime, Math.PI)); result.defineAnnotatedMethods(RubyMath.class); return result; }