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.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-05-15 14:59:48 +09:00
parent 138845a519
commit 780342eddb
+1
View File
@@ -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