aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-16 23:07:07 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-16 23:07:07 +0000
commit24691fa633a71d5ea831e23b83886a1ce6ef0117 (patch)
treeea46012711fae60c2fc767591797305ec842b036 /string.c
parent58c0100a779a354cd53a53cf1c2fbc6cfc88240f (diff)
downloadruby-24691fa633a71d5ea831e23b83886a1ce6ef0117.tar.gz
* string.c (rb_str_lines): now takes optional argument for the
line separator. * io.c (rb_io_lines, rb_io_bytes): new methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/string.c b/string.c
index b7466f9177..13c051f9f2 100644
--- a/string.c
+++ b/string.c
@@ -3550,7 +3550,7 @@ rb_str_split(VALUE str, const char *sep0)
/*
* call-seq:
- * str.lines => anEnumerator
+ * str.lines(separator=$/) => anEnumerator
*
* Returns an enumerator that gives each line in the string.
*
@@ -3559,9 +3559,9 @@ rb_str_split(VALUE str, const char *sep0)
*/
static VALUE
-rb_str_lines(VALUE str)
+rb_str_lines(int argc, VALUE *argv, VALUE str)
{
- return rb_enumeratorize(str, ID2SYM(rb_intern("each_line")), 0, 0);
+ return rb_enumeratorize(str, ID2SYM(rb_intern("each_line")), argc, argv);
}
/*
@@ -4881,7 +4881,7 @@ Init_String(void)
rb_define_method(rb_cString, "hex", rb_str_hex, 0);
rb_define_method(rb_cString, "oct", rb_str_oct, 0);
rb_define_method(rb_cString, "split", rb_str_split_m, -1);
- rb_define_method(rb_cString, "lines", rb_str_lines, 0);
+ rb_define_method(rb_cString, "lines", rb_str_lines, -1);
rb_define_method(rb_cString, "bytes", rb_str_bytes, 0);
rb_define_method(rb_cString, "reverse", rb_str_reverse, 0);
rb_define_method(rb_cString, "reverse!", rb_str_reverse_bang, 0);