diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-05-15 14:59:48 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-05-15 14:59:48 +0900 |
| commit | 780342eddb880a1c0a457311b005398ce36d0c9f (patch) | |
| tree | 40f29b6c7777c7d81871fc2e107097165f2a5b83 | |
| parent | 138845a5194a8a0b51e3d68a3b27c82b5795616a (diff) | |
| download | mruby-780342eddb880a1c0a457311b005398ce36d0c9f.tar.gz mruby-780342eddb880a1c0a457311b005398ce36d0c9f.zip | |
Add Enumerator support to `String#each_byte`.
`String#each_byte` is not defined in ISO Ruby but it is implemented in
the core mruby because it's useful.
| -rw-r--r-- | mrblib/string.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mrblib/string.rb b/mrblib/string.rb index 42d594055..b0fe4033e 100644 --- a/mrblib/string.rb +++ b/mrblib/string.rb @@ -167,6 +167,7 @@ class String ## # Call the given block for each byte of +self+. def each_byte(&block) + return to_enum(:each_byte, &block) unless block bytes = self.bytes pos = 0 while pos < bytes.size |
