Package org.jruby

Examples of org.jruby.RubyModule.defineAnnotatedMethods()


    // #1194: ClassFormatError with Nokogiri 1.6.0
    public void testVersionedMethods() {
        RubyModule mod = runtime.defineModule("GH1194");

        mod.defineAnnotatedMethods(VersionedMethods.class);

        assertNotNull(mod.searchMethod("method"));
    }

    private void confirmMethods(RubyModule mod) {
View Full Code Here


public class JavaProxyMethods {
    public static RubyModule createJavaProxyMethods(ThreadContext context) {
        Ruby runtime = context.runtime;
        RubyModule javaProxyMethods = runtime.defineModule("JavaProxyMethods");
       
        javaProxyMethods.defineAnnotatedMethods(JavaProxyMethods.class);
       
        return javaProxyMethods;
    }
   
    @JRubyMethod
View Full Code Here

    public void load(Ruby runtime, boolean wrap) {
        RubyClass moduleClass = runtime.getModule();
        moduleClass.defineAnnotatedMethods(TruffelizeModule.class);

        RubyModule kernelModule = runtime.getKernel();
        kernelModule.defineAnnotatedMethods(TruffelizeKernel.class);
    }

    public static void truffelize(RubyModule module, String name) {
        final DynamicMethod method = module.searchMethod(name);
View Full Code Here

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

        // 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 CoverageLibrary implements Library {
    public void load(Ruby runtime, boolean wrap) {
        RubyModule coverage = runtime.defineModule("Coverage");
       
        coverage.defineAnnotatedMethods(CoverageModule.class);
    }
}
View Full Code Here

        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);
View Full Code Here

        // 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);
View Full Code Here

                }
            }
        });

        RubyModule mDigest = runtime.defineModule("Digest");
        mDigest.defineAnnotatedMethods(RubyDigest.class);
        RubyModule mDigestInstance = mDigest.defineModuleUnder("Instance");
        mDigestInstance.defineAnnotatedMethods(DigestInstance.class);
        RubyClass cDigestClass = mDigest.defineClassUnder("Class", runtime.getObject(), DigestClass.DIGEST_CLASS_ALLOCATOR);
        cDigestClass.defineAnnotatedMethods(DigestClass.class);
        cDigestClass.includeModule(mDigestInstance);
View Full Code Here

        });

        RubyModule mDigest = runtime.defineModule("Digest");
        mDigest.defineAnnotatedMethods(RubyDigest.class);
        RubyModule mDigestInstance = mDigest.defineModuleUnder("Instance");
        mDigestInstance.defineAnnotatedMethods(DigestInstance.class);
        RubyClass cDigestClass = mDigest.defineClassUnder("Class", runtime.getObject(), DigestClass.DIGEST_CLASS_ALLOCATOR);
        cDigestClass.defineAnnotatedMethods(DigestClass.class);
        cDigestClass.includeModule(mDigestInstance);
        RubyClass cDigestBase = mDigest.defineClassUnder("Base", cDigestClass, DigestBase.DIGEST_BASE_ALLOCATOR);
        cDigestBase.defineAnnotatedMethods(DigestBase.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.