diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-06-29 16:49:16 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-06-29 16:49:16 +0900 |
| commit | b2b0329d2983230508fa79766c0651e78f30b99f (patch) | |
| tree | 8c4bd6e0ccc7ba85609dc1e5ebc2004429bd319a /mrbgems/mruby-string-ext | |
| parent | f09eb196da7a956afae2be75d99dd2b3955c2b28 (diff) | |
| download | mruby-b2b0329d2983230508fa79766c0651e78f30b99f.tar.gz mruby-b2b0329d2983230508fa79766c0651e78f30b99f.zip | |
string.rb: `upto` to break when the string length is longer than `end`.
Diffstat (limited to 'mrbgems/mruby-string-ext')
| -rw-r--r-- | mrbgems/mruby-string-ext/mrblib/string.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mrbgems/mruby-string-ext/mrblib/string.rb b/mrbgems/mruby-string-ext/mrblib/string.rb index 4f533c4cd..2b3071567 100644 --- a/mrbgems/mruby-string-ext/mrblib/string.rb +++ b/mrbgems/mruby-string-ext/mrblib/string.rb @@ -457,6 +457,8 @@ class String break if exclusive and n == 0 yield bs break if n == 0 + bsiz = bs.size + break if bsiz > max.size || bsiz == 0 bs = bs.succ end self |
