diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-04-28 12:03:32 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-04-28 13:57:46 +0900 |
| commit | 468578113ad91878d1da409006d3b3aa73144d21 (patch) | |
| tree | f89b77b9a1933dfaeaa840d364547038910b1359 | |
| parent | 2c32154115fc4fe753eff0075d6a204d899f1cb6 (diff) | |
| download | mruby-468578113ad91878d1da409006d3b3aa73144d21.tar.gz mruby-468578113ad91878d1da409006d3b3aa73144d21.zip | |
Update `IO#ungetc` to keep `@buf` string; ref #4982
| -rw-r--r-- | mrbgems/mruby-io/mrblib/io.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mrbgems/mruby-io/mrblib/io.rb b/mrbgems/mruby-io/mrblib/io.rb index 5df1932df..c0cfdc403 100644 --- a/mrbgems/mruby-io/mrblib/io.rb +++ b/mrbgems/mruby-io/mrblib/io.rb @@ -182,9 +182,9 @@ class IO def ungetc(substr) raise TypeError.new "expect String, got #{substr.class}" unless substr.is_a?(String) if @buf.empty? - @buf = substr.dup + @buf.replace(substr) else - @buf = substr + @buf + @buf[0,0] = substr end nil end |
