Sha256: a452f55e011c5363e559865ff99120414ec67fed6fe9e93bdcf7fe4cf9e3ca26

Contents?: true

Size: 1.76 KB

Versions: 12

Compression:

Stored size: 1.76 KB

Contents

o:$YARD::CodeObjects::MethodObject:
@name:	upto:@docstringIC:YARD::Docstring"­Iterates <em>block</em>, passing in integer values from <i>int</i>
up to and including <i>limit</i>.

   5.upto(10) { |i| print i, " " }

<em>produces:</em>

   5 6 7 8 9 10
:@objectu:YARD::StubProxyInteger#upto:
@summary0:	@all"æIterates <em>block</em>, passing in integer values from <i>int</i>
up to and including <i>limit</i>.

   5.upto(10) { |i| print i, " " }

<em>produces:</em>

   5 6 7 8 9 10


@overload upto(limit)
  @yield [i]
  @return [Integer]:@ref_tags[:
@tags[o:YARD::Tags::OverloadTag
;
u;Integer#upto;;;IC;	"
;
u;Integer#upto;0;
"!@yield [i]
@return [Integer];[;[o:YARD::Tags::Tag
;
0;0:@types["i:
@text":@tag_name"
yieldo;
;
0;0;["Integer;";"return;0:@parameters[[:
limit0;0:@signature"upto(limit);"
overload:@current_file_has_commentsF:@scope:
instance;[:@docstring_extra0:@files[["numeric.c0:@namespaceu;Integer:
@path"Integer#upto;[:@visibility:public:@source"ñ/*
 *  call-seq:
 *     int.upto(limit) {|i| block }     => int
 *
 *  Iterates <em>block</em>, passing in integer values from <i>int</i>
 *  up to and including <i>limit</i>.
 *
 *     5.upto(10) { |i| print i, " " }
 *
 *  <em>produces:</em>
 *
 *     5 6 7 8 9 10
 */

static VALUE
int_upto(from, to)
    VALUE from, to;
{
    RETURN_ENUMERATOR(from, 1, &to);

    if (FIXNUM_P(from) && FIXNUM_P(to)) {
    long i, end;

    end = FIX2LONG(to);
    for (i = FIX2LONG(from); i <= end; i++) {
        rb_yield(LONG2FIX(i));
    }
    }
    else {
    VALUE i = from, c;

    while (!(c = rb_funcall(i, '>', 1, to))) {
        rb_yield(i);
        i = rb_funcall(i, '+', 1, INT2FIX(1));
    }
    if (NIL_P(c)) rb_cmperr(i, to);
    }
    return from;
}:@source_type:c

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
pry-doc-0.4.4 lib/pry-doc/core_docs_18/objects/Integer/upto_i.dat
pry-doc-0.4.3 lib/pry-doc/core_docs_18/objects/Integer/upto_i.dat
pry-doc-0.4.2 lib/pry-doc/core_docs_18/objects/Integer/upto_i.dat
pry-doc-0.4.1 lib/pry-doc/core_docs_18/objects/Integer/upto_i.dat
pry-doc-0.4.0 lib/pry-doc/core_docs_18/objects/Integer/upto_i.dat
pry-doc-0.3.0 lib/pry-doc/core_docs_18/objects/Integer/upto_i.dat
pry-doc-0.2.4pre1 lib/pry-doc/core_docs_18/objects/Integer/upto_i.dat
pry-doc-0.2.3pre1 lib/pry-doc/core_docs_18/objects/Integer/upto_i.dat
pry-doc-0.2.1 lib/pry-doc/core_docs_18/objects/Integer/upto_i.dat
pry-doc-0.2.0 lib/pry-doc/core_docs_18/objects/Integer/upto_i.dat
pry-doc-0.1.5pre1 lib/pry-doc/core_docs_18/objects/Integer/upto_i.dat
pry-0.6.9pre1-i386-mingw32 lib/pry/core_docs_18/objects/Integer/upto_i.dat