From 780342eddb880a1c0a457311b005398ce36d0c9f Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 15 May 2019 14:59:48 +0900 Subject: 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. --- mrblib/string.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'mrblib') 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 -- cgit v1.2.3