Sha256: c9d2b0599014f99f111878fee1a5103e50c53ac13c5e60c35f331f9872949a76

Contents?: true

Size: 1.93 KB

Versions: 12

Compression:

Stored size: 1.93 KB

Contents

o:$YARD::CodeObjects::MethodObject:
@name:
first:@docstringIC:YARD::Docstring"�Returns the first element, or the first +n+ elements, of the enumerable.
If the enumerable is empty, the first form returns <code>nil</code>, and the
second form returns an empty array.
:@objectu:YARD::StubProxyEnumerable#first:
@summary0:	@all"	Returns the first element, or the first +n+ elements, of the enumerable.
If the enumerable is empty, the first form returns <code>nil</code>, and the
second form returns an empty array.



@overload first
  @return [Object, nil]
@overload first(n)
  @return [Array]:@ref_tags[:
@tags[o:YARD::Tags::OverloadTag
;
u;Enumerable#first;;;IC;	"
;
u;Enumerable#first;0;
"@return [Object, nil];[;[o:YARD::Tags::Tag
;
0;0:@types["Object"nil:
@text":@tag_name"return;0:@parameters[;0:@signature"
first;"
overloado;
;
u;Enumerable#first;;;IC;	"
;
u;Enumerable#first;0;
"@return [Array];[;[o;
;
0;0;["
Array;";"return;0;[[:n0;0;"
first(n);"
overload:@current_file_has_commentsF:@scope:
instance;[:@docstring_extra0:@files[["enum.c0:@namespaceu;Enumerable:
@path"Enumerable#first;[:@visibility:public:@source"�/*
 *  call-seq:
 *     enum.first      -> obj or nil
 *     enum.first(n)   -> an_array
 *
 *  Returns the first element, or the first +n+ elements, of the enumerable.
 *  If the enumerable is empty, the first form returns <code>nil</code>, and the
 *  second form returns an empty array.
 *
 */

static VALUE
enum_first(argc, argv, obj)
    int argc;
    VALUE *argv;
    VALUE obj;
{
    VALUE n, ary[2];

    if (argc == 0) {
    ary[0] = ary[1] = Qnil;
    }
    else {
    long len;
    rb_scan_args(argc, argv, "01", &n);
    len = NUM2LONG(n);
    if (len == 0) return rb_ary_new2(0);
    ary[0] = INT2NUM(len);
    ary[1] = rb_ary_new2(len);
    }
    rb_block_call(obj, id_each, 0, 0, first_i, (VALUE)ary);

    return ary[1];
}:@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/Enumerable/first_i.dat
pry-doc-0.4.3 lib/pry-doc/core_docs_18/objects/Enumerable/first_i.dat
pry-doc-0.4.2 lib/pry-doc/core_docs_18/objects/Enumerable/first_i.dat
pry-doc-0.4.1 lib/pry-doc/core_docs_18/objects/Enumerable/first_i.dat
pry-doc-0.4.0 lib/pry-doc/core_docs_18/objects/Enumerable/first_i.dat
pry-doc-0.3.0 lib/pry-doc/core_docs_18/objects/Enumerable/first_i.dat
pry-doc-0.2.4pre1 lib/pry-doc/core_docs_18/objects/Enumerable/first_i.dat
pry-doc-0.2.3pre1 lib/pry-doc/core_docs_18/objects/Enumerable/first_i.dat
pry-doc-0.2.1 lib/pry-doc/core_docs_18/objects/Enumerable/first_i.dat
pry-doc-0.2.0 lib/pry-doc/core_docs_18/objects/Enumerable/first_i.dat
pry-doc-0.1.5pre1 lib/pry-doc/core_docs_18/objects/Enumerable/first_i.dat
pry-0.6.9pre1-i386-mingw32 lib/pry/core_docs_18/objects/Enumerable/first_i.dat