From 5b1f25a4e0be7d1880f237b1c1bf5845af7b8588 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 17 Aug 2019 14:46:32 +0900 Subject: Implement `Array#each` using inline mruby bytecode. --- mrblib/array.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'mrblib/array.rb') diff --git a/mrblib/array.rb b/mrblib/array.rb index 2b080564c..6535d6d83 100644 --- a/mrblib/array.rb +++ b/mrblib/array.rb @@ -10,16 +10,16 @@ class Array # and pass the respective element. # # ISO 15.2.12.5.10 - def each(&block) - return to_enum :each unless block + # def each(&block) + # return to_enum :each unless block - idx = 0 - while idx < length - block.call(self[idx]) - idx += 1 - end - self - end + # idx = 0 + # while idx < length + # block.call(self[idx]) + # idx += 1 + # end + # self + # end ## # Calls the given block for each element of +self+ -- cgit v1.2.3