Package org.jruby

Examples of org.jruby.RubyArray.callMethod()


                if (res == null) {
                    p--;
                    { p += 1; _goto_targ = 5; if (truecontinue _goto;}
                } else {
                    if (!parser.arrayClass.getName().equals("Array")) {
                        result.callMethod(context, "<<", res.result);
                    } else {
                        result.append(res.result);
                    }
                    {p = (( res.p))-1;}
                }
View Full Code Here


            script.append("$failed").append('\n');

            RubyArray lastFailed = (RubyArray)runtime.executeScript(script.toString(), scriptName() + "_generated_test.rb");
           
            if (!lastFailed.isEmpty()) {
                RubyString message = (RubyString) lastFailed.callMethod(lastFailed.getRuntime().getCurrentContext(), "to_s");
                fail(scriptName() + " failed, complete failure list follows:\n" + message.toString());
            }

            System.out.flush(); // Without a flush Ant will miss some of our output
        }
View Full Code Here

        try {
            RubyArray array = context.getRuntime().newArray();
            Iterator<Object> itr = set.iterator();
            while (itr.hasNext()) {
                Object value = itr.next();
                array.callMethod(context, "<<", DiametricUtils.convertJavaToRuby(context, value));
            }
            return array;
        } catch (Throwable t) {
            throw context.getRuntime().newRuntimeError(t.getMessage());
        }
View Full Code Here

            LazySeq value = (LazySeq) var.invoke(nil_p, vector_or_seq);
            Iterator itr = value.iterator();
            RubyArray result = context.getRuntime().newArray();
            while (itr.hasNext()) {
                Object obj = itr.next();
                result.callMethod("<<", DiametricUtils.convertJavaToRuby(context, obj));
            }
            return result;
        } catch (Throwable t) {
            throw context.getRuntime().newRuntimeError(t.getMessage());
        }
View Full Code Here

class DiametricCommon {
    IRubyObject collect(ThreadContext context, Block block, Iterator<Object> itr) {
        RubyArray ary = context.getRuntime().newArray();
        while (itr.hasNext()) {
            IRubyObject next = DiametricUtils.convertJavaToRuby(context, itr.next());
            ary.callMethod(context, "<<", block.yield(context, next));
        }
        return ary;
    }

    IRubyObject count(ThreadContext context, IRubyObject arg, Object target) {
View Full Code Here

        while (itr.hasNext()) {
            IRubyObject next = DiametricUtils.convertJavaToRuby(context, itr.next());
            if (block.yield(context, next).isTrue()) {
                continue;
            } else {
                ary.callMethod(context, "<<", next);
                break;
            }
        }
        while (itr.hasNext()) {
            ary.callMethod(context, "<<", DiametricUtils.convertJavaToRuby(context, itr.next()));
View Full Code Here

                ary.callMethod(context, "<<", next);
                break;
            }
        }
        while (itr.hasNext()) {
            ary.callMethod(context, "<<", DiametricUtils.convertJavaToRuby(context, itr.next()));
        }
        return ary;
    }

    void each(ThreadContext context, Block block, Iterator<Object> itr) {
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.