Method: StringIO#readlines
- Defined in:
- ext/stringio/stringio.c
#readlines(sep = $/, chomp: false) ⇒ Array #readlines(limit, chomp: false) ⇒ Array #readlines(sep, limit, chomp: false) ⇒ Array
See IO#readlines.
1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 |
# File 'ext/stringio/stringio.c', line 1372 static VALUE strio_readlines(int argc, VALUE *argv, VALUE self) { VALUE ary, line; struct getline_arg arg; StringIO(self); ary = rb_ary_new(); if (prepare_getline_args(&arg, argc, argv)->limit == 0) { rb_raise(rb_eArgError, "invalid limit: 0 for readlines"); } while (!NIL_P(line = strio_getline(&arg, readable(self)))) { rb_ary_push(ary, line); } return ary; } |