Package org.jruby

Examples of org.jruby.RubyClass.include()


        if (!implBlock.isGiven()) throw runtime.newArgumentError("block required to call #impl on a Java interface");

        final RubyArray methodNames = (args.length > 0) ? runtime.newArray(args) : null;

        RubyClass implClass = RubyClass.newClass(runtime, runtime.getObject());
        implClass.include(new IRubyObject[] {self});

        IRubyObject implObject = implClass.callMethod(context, "new");

        implClass.addMethod("method_missing",
                new org.jruby.internal.runtime.methods.JavaMethod(implClass, Visibility.PUBLIC) {
View Full Code Here


        Ruby runtime = context.runtime;

        RubyClass implClass = (RubyClass)self.getInstanceVariables().getInstanceVariable("@__implementation");
        if (implClass == null) {
            implClass = RubyClass.newClass(runtime, (RubyClass)runtime.getClass("InterfaceJavaProxy"));
            implClass.include(new IRubyObject[] {self});
            RuntimeHelpers.setInstanceVariable(implClass, self, "@__implementation");
        }

        return RuntimeHelpers.invoke(context, implClass, "new", args, block);
    }
View Full Code Here

                            throw context.runtime.newTypeError("append_features called with non-class");
                        }
                        RubyClass target = (RubyClass)arg;
                        RubyArray javaInterfaceMods = (RubyArray)self.getInstanceVariables().getInstanceVariable("@java_interface_mods");

                        target.include(javaInterfaceMods.toJavaArray());

                        return Helpers.invokeAs(context, clazz.getSuperClass(), self, name, arg, block);
                    }
                });
            } else {
View Full Code Here

    public static IRubyObject extended(ThreadContext context, IRubyObject self, IRubyObject object) {
        if (!(self instanceof RubyModule)) {
            throw context.runtime.newTypeError(self, context.runtime.getModule());
        }
        RubyClass singleton = object.getSingletonClass();
        singleton.include(new IRubyObject[] {self});
        return singleton;
    }

    @JRubyMethod(name = "[]", rest = true)
    public static IRubyObject op_aref(ThreadContext context, IRubyObject self, IRubyObject[] args) {
View Full Code Here

        if (!implBlock.isGiven()) throw runtime.newArgumentError("block required to call #impl on a Java interface");

        final RubyArray methodNames = (args.length > 0) ? runtime.newArray(args) : null;

        RubyClass implClass = RubyClass.newClass(runtime, runtime.getObject());
        implClass.include(new IRubyObject[] {self});

        IRubyObject implObject = implClass.callMethod(context, "new");

        implClass.addMethod("method_missing",
                new org.jruby.internal.runtime.methods.JavaMethod(implClass, Visibility.PUBLIC) {
View Full Code Here

        Ruby runtime = context.runtime;

        RubyClass implClass = (RubyClass)self.getInstanceVariables().getInstanceVariable("@__implementation");
        if (implClass == null) {
            implClass = RubyClass.newClass(runtime, (RubyClass)runtime.getClass("InterfaceJavaProxy"));
            implClass.include(new IRubyObject[] {self});
            Helpers.setInstanceVariable(implClass, self, "@__implementation");
        }

        return Helpers.invoke(context, implClass, "new", args, block);
    }
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.