Package org.jruby

Examples of org.jruby.RubyProc.call()


                rubyArgs[1] = method;
                for (int i = 0; i < length; i++) {
                    rubyArgs[i + 2] = JavaUtil.convertJavaToRuby(getRuntime(),
                            nargs[i]);
                }
                IRubyObject call_result = proc.call(getRuntime().getCurrentContext(), rubyArgs);
                Object converted_result = JavaUtil.convertRubyToJava(
                        call_result, method.getReturnType());
                return converted_result;
            }
View Full Code Here


                        newArgs = IRubyObject.NULL_ARRAY;
                    } else {
                        newArgs = new IRubyObject[args.length - 1];
                        System.arraycopy(args, 1, newArgs, 0, args.length - 1);
                    }
                    return proc.call(context, newArgs);
                }

                @Override
                public DynamicMethod dup() {
                    return this;
View Full Code Here

                rubyArgs[0] = JavaObject.wrap(runtime, proxy);
                rubyArgs[1] = new JavaMethod(runtime, method);
                for (int i = 0; i < length; i++) {
                    rubyArgs[i + 2] = JavaObject.wrap(runtime, nargs[i]);
                }
                return JavaUtil.convertArgument(runtime, proc.call(runtime.getCurrentContext(), rubyArgs), method.getReturnType());
            }
        }));
    }

    @JRubyMethod(required = 2, frame = true, module = true, visibility = Visibility.PRIVATE)
View Full Code Here

        while (handler == null &&
               excptnClass != Throwable.class) {
            excptnClass = excptnClass.getSuperclass();
        }
        if (handler != null) {
            handler.call(runtime.getCurrentContext(), new IRubyObject[]{JavaUtil.convertJavaToRuby(runtime, exception)});
        } else {
            throw createRaiseException(exception);
        }
    }
View Full Code Here

                        newArgs = IRubyObject.NULL_ARRAY;
                    } else {
                        newArgs = new IRubyObject[args.length - 1];
                        System.arraycopy(args, 1, newArgs, 0, args.length - 1);
                    }
                    return proc.call(context, newArgs);
                }

                @Override
                public DynamicMethod dup() {
                    return this;
View Full Code Here

                rubyArgs[1] = method;
                for (int i = 0; i < length; i++) {
                    rubyArgs[i + 2] = JavaUtil.convertJavaToRuby(getRuntime(),
                            nargs[i]);
                }
                IRubyObject call_result = proc.call(getRuntime().getCurrentContext(), rubyArgs);
                Object converted_result = call_result.toJava(method.getReturnType());
                return converted_result;
            }

        };
View Full Code Here

                rubyArgs[1] = method;
                for (int i = 0; i < length; i++) {
                    rubyArgs[i + 2] = JavaUtil.convertJavaToRuby(getRuntime(),
                            nargs[i]);
                }
                IRubyObject call_result = proc.call(getRuntime().getCurrentContext(), rubyArgs);
                Object converted_result = call_result.toJava(method.getReturnType());
                return converted_result;
            }

        };
View Full Code Here

                        newArgs = IRubyObject.NULL_ARRAY;
                    } else {
                        newArgs = new IRubyObject[args.length - 1];
                        System.arraycopy(args, 1, newArgs, 0, args.length - 1);
                    }
                    return proc.call(context, newArgs);
                }

                @Override
                public DynamicMethod dup() {
                    return this;
View Full Code Here

        if (assertionProviderList == null)
            return null;
        for (String method : assertionProviderList) {
            RubyProc proc = (RubyProc) interpreter.evalScriptlet("proc { |x| " + method + " x }");
            RubyArray ret = (RubyArray) proc.call(interpreter.getCurrentContext(),
                    new IRubyObject[] { JavaEmbedUtils.javaToRuby(interpreter, component) });
            for (int i = 0; i < ret.size(); i++) {
                RubyArray object = (RubyArray) ret.get(i);
                String[] assertion = new String[3];
                assertion[0] = object.get(0).toString();
View Full Code Here

                        newArgs = IRubyObject.NULL_ARRAY;
                    } else {
                        newArgs = new IRubyObject[args.length - 1];
                        System.arraycopy(args, 1, newArgs, 0, args.length - 1);
                    }
                    return proc.call(context, newArgs);
                }

                @Override
                public DynamicMethod dup() {
                    return this;
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.