1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/stringio/stringio.c (StringIO#ungetbyte): New method

backported from 1.9



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2009-03-23 12:20:57 +00:00
parent 8ed8379314
commit 24894b3d34
3 changed files with 17 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Mon Mar 23 21:18:30 2009 Akinori MUSHA <knu@iDaemons.org>
* ext/stringio/stringio.c (StringIO#ungetbyte): New method
backported from 1.9.
Mon Mar 23 21:16:21 2009 Akinori MUSHA <knu@iDaemons.org>
* process.c: Stick with the K&R style in 1.8.

6
NEWS
View file

@ -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

View file

@ -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);