APIdock / Ruby
/
method

lines

ruby latest stable - Class: String
lines(*args)
public

Returns an array of lines in str split using the supplied record separator ($/ by default). This is a shorthand for str.each_line(separator).to_a.

If a block is given, which is a deprecated form, works the same as each_line.

static VALUE
rb_str_lines(int argc, VALUE *argv, VALUE str)
{
 VALUE ary = WANTARRAY("lines", 0);
 return rb_str_enumerate_lines(argc, argv, str, ary);
}

AltStyle によって変換されたページ (->オリジナル) /