private IRubyObject stepCommon(ThreadContext context, IRubyObject to, IRubyObject step, Block block) { Ruby runtime = context.runtime; if (this instanceof RubyFixnum && to instanceof RubyFixnum && step instanceof RubyFixnum) { fixnumStep(context, runtime, ((RubyFixnum)this).getLongValue(), ((RubyFixnum)to).getLongValue(), ((RubyFixnum)step).getLongValue(), block); } else if (this instanceof RubyFloat || to instanceof RubyFloat || step instanceof RubyFloat) { floatStep19(context, runtime, this, to, step, false, block); } else { duckStep(context, runtime, this, to, step, block); } return this; }
private IRubyObject stepCommon(ThreadContext context, IRubyObject to, IRubyObject step, Block block) { Ruby runtime = context.runtime; if (this instanceof RubyFixnum && to instanceof RubyFixnum && step instanceof RubyFixnum) { fixnumStep(context, runtime, ((RubyFixnum)this).getLongValue(), ((RubyFixnum)to).getLongValue(), ((RubyFixnum)step).getLongValue(), block); } else if (this instanceof RubyFloat || to instanceof RubyFloat || step instanceof RubyFloat) { floatStep19(context, runtime, this, to, step, false, block); } else { duckStep(context, runtime, this, to, step, block); } return this; }
private IRubyObject stepCommon(ThreadContext context, IRubyObject to, IRubyObject step, boolean desc, Block block) { Ruby runtime = context.runtime; boolean inf; if (step.op_equal(context, RubyFixnum.zero(runtime)).isTrue()) { inf = true; } else if (to instanceof RubyFloat) { double f = ((RubyFloat) to).getDoubleValue(); inf = Double.isInfinite(f) && (f <= -0.0 ? desc : !desc); } else { inf = false; } if (this instanceof RubyFixnum && (inf || to instanceof RubyFixnum) && step instanceof RubyFixnum) { fixnumStep(context, runtime, (RubyFixnum) this, to, (RubyFixnum) step, inf, desc, block); } else if (this instanceof RubyFloat || to instanceof RubyFloat || step instanceof RubyFloat) { floatStep(context, runtime, this, to, step, false, block); } else { duckStep(context, this, to, step, inf, desc, block); } return this; }
private IRubyObject stepCommon(ThreadContext context, IRubyObject to, IRubyObject step, boolean desc, Block block) { Ruby runtime = context.runtime; boolean inf; if (step.op_equal(context, RubyFixnum.zero(runtime)).isTrue()) { inf = true; } else if (to instanceof RubyFloat) { double f = ((RubyFloat) to).getDoubleValue(); inf = Double.isInfinite(f) && (f <= -0.0 ? desc : !desc); } else { inf = false; } if (this instanceof RubyFixnum && (inf || to instanceof RubyFixnum) && step instanceof RubyFixnum) { fixnumStep(context, runtime, (RubyFixnum) this, to, (RubyFixnum) step, inf, desc, block); } else if (this instanceof RubyFloat || to instanceof RubyFloat || step instanceof RubyFloat) { floatStep(context, runtime, this, to, step, false, block); } else { duckStep(context, this, to, step, inf, desc, block); } return this; }