Examples of callMethod()


Examples of org.jruby.runtime.builtin.IRubyObject.callMethod()

                IRubyObject difference_minutes = absolute_difference.callMethod(context,"/", self.getRuntime().newFixnum(60)).callMethod(context, "round");
                tz = self.getRuntime().newString("%s%02d:%02d").callMethod(context,"%", self.getRuntime().newArrayNoCopy(new IRubyObject[]{difference_sign,difference_minutes.callMethod(context,"/", self.getRuntime().newFixnum(60)),difference_minutes.callMethod(context,"%", self.getRuntime().newFixnum(60))}));
            }
            IRubyObject standard = self.callMethod(context,"strftime", self.getRuntime().newString("%Y-%m-%d %H:%M:%S"));
            if(self.callMethod(context, "usec").callMethod(context, "nonzero?").isTrue()) {
                standard = standard.callMethod(context, MethodIndex.OP_PLUS, "+", self.getRuntime().newString(".%06d").callMethod(context,"%", self.getRuntime().newArray(self.callMethod(context, "usec"))));
            }
            standard = standard.callMethod(context,MethodIndex.OP_PLUS, "+", self.getRuntime().newString(" %s").callMethod(context,"%", self.getRuntime().newArray(tz)));
            return RuntimeHelpers.invoke(context, arg, "scalar", self.callMethod(context, "taguri"), standard, self.callMethod(context, "to_yaml_style"));
        }
    }
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.callMethod()

            }
            IRubyObject standard = self.callMethod(context,"strftime", self.getRuntime().newString("%Y-%m-%d %H:%M:%S"));
            if(self.callMethod(context, "usec").callMethod(context, "nonzero?").isTrue()) {
                standard = standard.callMethod(context, MethodIndex.OP_PLUS, "+", self.getRuntime().newString(".%06d").callMethod(context,"%", self.getRuntime().newArray(self.callMethod(context, "usec"))));
            }
            standard = standard.callMethod(context,MethodIndex.OP_PLUS, "+", self.getRuntime().newString(" %s").callMethod(context,"%", self.getRuntime().newArray(tz)));
            return RuntimeHelpers.invoke(context, arg, "scalar", self.callMethod(context, "taguri"), standard, self.callMethod(context, "to_yaml_style"));
        }
    }
   
    @JRubyClass(name="Date")
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.callMethod()

    private void rangeEach(ThreadContext context, RangeCallBack callback) {
        IRubyObject v = begin;
        if (isExclusive) {
            while (rangeLt(context, v, end) != null) {
                callback.call(context, v);
                v = v.callMethod(context, "succ");
            }
        } else {
            IRubyObject c;
            while ((c = rangeLe(context, v, end)) != null && c.isTrue()) {
                callback.call(context, v);
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.callMethod()

                } else {
                    method = "<=";
                    methodIndex = MethodIndex.OP_LE;
                }
                IRubyObject beg = begin;
                while (beg.callMethod(context, methodIndex, method, end).isTrue()) {
                    block.yield(context, beg);
                    beg = beg.callMethod(context, MethodIndex.OP_PLUS, "+", step);
                }
            } else {
                if (unit == 0) throw runtime.newArgumentError("step can't be 0");
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.callMethod()

                    methodIndex = MethodIndex.OP_LE;
                }
                IRubyObject beg = begin;
                while (beg.callMethod(context, methodIndex, method, end).isTrue()) {
                    block.yield(context, beg);
                    beg = beg.callMethod(context, MethodIndex.OP_PLUS, "+", step);
                }
            } else {
                if (unit == 0) throw runtime.newArgumentError("step can't be 0");
                if (!begin.respondsTo("succ")) throw runtime.newTypeError(
                        "can't iterate from " + begin.getMetaClass().getName());
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.callMethod()

        StringBuilder buffer = new StringBuilder(100);

        buffer.append(fileName).append(':').append(lineNumber + 1).append(' ');
        buffer.append("warning: ").append(message).append('\n');
        IRubyObject errorStream = runtime.getGlobalVariables().get("$stderr");
        errorStream.callMethod(runtime.getCurrentContext(), "write", runtime.newString(buffer.toString()));
    }

    public boolean isVerbose() {
        return runtime.getVerbose().isTrue();
    }
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.callMethod()

        IRubyObject z = callMethod(context, "%", dividend);
        IRubyObject x = this;
        RubyFixnum zero = RubyFixnum.zero(getRuntime());

        if (!equalInternal(context, z, zero) &&
                ((x.callMethod(context, MethodIndex.OP_LT, "<", zero).isTrue() &&
                dividend.callMethod(context, MethodIndex.OP_GT, ">", zero).isTrue()) ||
                (x.callMethod(context, MethodIndex.OP_GT, ">", zero).isTrue() &&
                dividend.callMethod(context, MethodIndex.OP_LT, "<", zero).isTrue()))) {
            return z.callMethod(context, MethodIndex.OP_MINUS, "-", dividend);
        } else {
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.callMethod()

        RubyFixnum zero = RubyFixnum.zero(getRuntime());

        if (!equalInternal(context, z, zero) &&
                ((x.callMethod(context, MethodIndex.OP_LT, "<", zero).isTrue() &&
                dividend.callMethod(context, MethodIndex.OP_GT, ">", zero).isTrue()) ||
                (x.callMethod(context, MethodIndex.OP_GT, ">", zero).isTrue() &&
                dividend.callMethod(context, MethodIndex.OP_LT, "<", zero).isTrue()))) {
            return z.callMethod(context, MethodIndex.OP_MINUS, "-", dividend);
        } else {
            return z;
        }
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.callMethod()

                if (minMemo == null) {
                    minMemo = maxMemo = v;
                    result[0] = result[1] = arg;
                } else {
                    if (RubyComparable.cmpint(ctx, v.callMethod(ctx,
                        MethodIndex.OP_SPACESHIP, "<=>", minMemo), v, minMemo) < 0) {
                        minMemo = v;
                        result[0] = arg;
                    }
                    if (RubyComparable.cmpint(ctx, v.callMethod(ctx,
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.callMethod()

                    if (RubyComparable.cmpint(ctx, v.callMethod(ctx,
                        MethodIndex.OP_SPACESHIP, "<=>", minMemo), v, minMemo) < 0) {
                        minMemo = v;
                        result[0] = arg;
                    }
                    if (RubyComparable.cmpint(ctx, v.callMethod(ctx,
                            MethodIndex.OP_SPACESHIP, "<=>", maxMemo), v, maxMemo) > 0) {
                        maxMemo = v;
                        result[1] = arg;
                    }
                }
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.