diff options
| -rw-r--r-- | mrbgems/mruby-io/mrblib/io.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/mrbgems/mruby-io/mrblib/io.rb b/mrbgems/mruby-io/mrblib/io.rb index a60562846..9ce49e51a 100644 --- a/mrbgems/mruby-io/mrblib/io.rb +++ b/mrbgems/mruby-io/mrblib/io.rb @@ -184,9 +184,15 @@ class IO nil end - def ungetbyte(substr) - substr = substr.chr if substr.is_a? Integer - ungetc substr + def ungetbyte(c) + if c.is_a? String + c = c.getbyte(0) + else + c &= 0xff + end + s = " " + s.setbyte(0,c) + ungetc s end def read(length = nil, outbuf = "") |
