Package org.jruby

Examples of org.jruby.RubyModule.defineAnnotatedMethods()


public class JRubyTypeLibrary implements Library {

    public void load(Ruby runtime, boolean wrap) throws IOException {
        RubyModule jrubyType = runtime.defineModule("Type");
        jrubyType.defineAnnotatedMethods(JRubyTypeLibrary.class);
    }

    @JRubyMethod(module = true)
    public static IRubyObject coerce_to(ThreadContext context, IRubyObject self, IRubyObject object, IRubyObject clazz, IRubyObject method) {
        Ruby ruby = object.getRuntime();
View Full Code Here


*/
public class JRubyUtilLibrary implements Library {

    public void load(Ruby runtime, boolean wrap) throws IOException {
        RubyModule mJRubyUtil = runtime.getOrCreateModule("JRuby").defineModuleUnder("Util");
        mJRubyUtil.defineAnnotatedMethods(JRubyUtilLibrary.class);
    }

    @JRubyMethod(module = true)
    public static void gc(IRubyObject recv) {
        System.gc();
View Full Code Here

        RubyModule mReadline = runtime.defineModule("Readline");

        mReadline.dataWrapStruct(holder);

        mReadline.defineAnnotatedMethods(Readline.class);
        IRubyObject hist = runtime.getObject().callMethod(runtime.getCurrentContext(), "new");
        mReadline.fastSetConstant("HISTORY", hist);
        hist.getSingletonClass().includeModule(runtime.getEnumerable());
        hist.getSingletonClass().defineAnnotatedMethods(HistoryMethods.class);
View Full Code Here

*/
public class IOModule {

    public static void createIOModule(Ruby runtime, RubyModule ffi) {
        RubyModule module = ffi.defineModuleUnder("IO");
        module.defineAnnotatedMethods(IOModule.class);
    }

    @JRubyMethod(name = "native_read", module = true)
    public static final IRubyObject native_read(ThreadContext context, IRubyObject self,
            IRubyObject src, IRubyObject dst, IRubyObject rbLength) {
View Full Code Here

        RubyClass cBufferedIO = (RubyClass)mNet.getConstant("BufferedIO");
        cBufferedIO.defineAnnotatedMethods(NetProtocolBufferedIO.class);

        RubyModule mNativeImpl = cBufferedIO.defineModuleUnder("NativeImplementation");

        mNativeImpl.defineAnnotatedMethods(NativeImpl.class);
    }   

    @JRubyMethod(required = 1)
    public static IRubyObject initialize(IRubyObject recv, IRubyObject io) {
        try {
View Full Code Here

        // These are not really used by timeout, but exposed for compatibility
        timeout.defineConstant("THIS_FILE", RubyRegexp.newRegexp(runtime, "timeout\\.rb", new RegexpOptions()));
        timeout.defineConstant("CALLER_OFFSET", RubyFixnum.newFixnum(runtime, 0));

        // Timeout module methods
        timeout.defineAnnotatedMethods(Timeout.class);

        // Toplevel defines
        runtime.getObject().defineConstant("TimeoutError", timeoutError);
        runtime.getObject().defineAnnotatedMethods(TimeoutToplevel.class);
    }
View Full Code Here

*/
public class IOModule {

    public static void createIOModule(Ruby runtime, RubyModule ffi) {
        RubyModule module = ffi.defineModuleUnder("IO");
        module.defineAnnotatedMethods(IOModule.class);
    }

    @JRubyMethod(name = "native_read", module = true)
    public static final IRubyObject native_read(ThreadContext context, IRubyObject self,
            IRubyObject src, IRubyObject dst, IRubyObject rbLength) {
View Full Code Here

    public static void createOpenSSL(Ruby runtime) {
        RubyModule ossl = runtime.getOrCreateModule("OpenSSL");
        RubyClass standardError = runtime.getClass("StandardError");
        ossl.defineClassUnder("OpenSSLError", standardError, standardError.getAllocator());
        ossl.defineAnnotatedMethods(OpenSSLModule.class);

        // those are BC provider free (uses BC class but does not use BC provider)
        PKey.createPKey(runtime, ossl);
        BN.createBN(runtime, ossl);
        Digest.createDigest(runtime, ossl);
View Full Code Here

@JRubyModule(name="JavaArrayUtilities")
public class JavaArrayUtilities {

    public static RubyModule createJavaArrayUtilitiesModule(Ruby runtime) {
        RubyModule javaArrayUtils = runtime.defineModule("JavaArrayUtilities");
        javaArrayUtils.defineAnnotatedMethods(JavaArrayUtilities.class);
        return javaArrayUtils;
    }
   
    @JRubyMethod(module = true, visibility = Visibility.PRIVATE)
    public static IRubyObject bytes_to_ruby_string(IRubyObject recv, IRubyObject wrappedObject) {
View Full Code Here

        // These are not really used by timeout, but exposed for compatibility
        timeout.defineConstant("THIS_FILE", RubyRegexp.newRegexp(runtime, "timeout\\.rb", new RegexpOptions()));
        timeout.defineConstant("CALLER_OFFSET", RubyFixnum.newFixnum(runtime, 0));

        // Timeout module methods
        timeout.defineAnnotatedMethods(Timeout.class);

        // Toplevel defines
        runtime.getObject().defineConstant("TimeoutError", timeoutError);
        runtime.getObject().defineAnnotatedMethods(TimeoutToplevel.class);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.