diff --git a/ChangeLog b/ChangeLog index 54ba755f26..710a6579fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Mar 23 21:18:30 2009 Akinori MUSHA + + * ext/stringio/stringio.c (StringIO#ungetbyte): New method + backported from 1.9. + Mon Mar 23 21:16:21 2009 Akinori MUSHA * process.c: Stick with the K&R style in 1.8. diff --git a/NEWS b/NEWS index f5f142202b..13771cdbe0 100644 --- a/NEWS +++ b/NEWS @@ -136,6 +136,12 @@ with all sufficient information, see the ChangeLog file. Return an enumerator if no block is given. +* stringio + + * StringIO#ungetbyte + + Added as an alias to #ungetc. + * rss * 0.2.4 -> 0.2.5 diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 3ed7d6b1af..16a836454f 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -726,7 +726,8 @@ strio_each_byte(self) /* * call-seq: - * strio.getc -> fixnum or nil + * strio.getbyte -> fixnum or nil + * strio.getc -> fixnum or nil * * See IO#getc. */ @@ -765,9 +766,10 @@ strio_extend(ptr, pos, len) /* * call-seq: - * strio.ungetc(integer) -> nil + * strio.ungetbyte(integer) -> nil + * strio.ungetc(integer) -> nil * - * Pushes back one character (passed as a parameter) onto *strio* + * Pushes back one byte (passed as a parameter) onto *strio* * such that a subsequent buffered read will return it. Pushing back * behind the beginning of the buffer string is not possible. Nothing * will be done if such an attempt is made. @@ -1356,6 +1358,7 @@ Init_stringio() rb_define_method(StringIO, "getc", strio_getc, 0); rb_define_method(StringIO, "getbyte", strio_getc, 0); rb_define_method(StringIO, "ungetc", strio_ungetc, 1); + rb_define_method(StringIO, "ungetbyte", strio_ungetc, 1); rb_define_method(StringIO, "readchar", strio_readchar, 0); rb_define_method(StringIO, "readbyte", strio_readchar, 0); rb_define_method(StringIO, "gets", strio_gets, -1);