mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user