From 3359b86ec7284234ae088ab682f82a0603029c34 Mon Sep 17 00:00:00 2001 From: Christopher Aue Date: Sun, 30 Jul 2017 13:19:31 +0200 Subject: Improved speed of enumeration methods --- mrblib/array.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mrblib/array.rb') diff --git a/mrblib/array.rb b/mrblib/array.rb index be98f217e..5b9ee47c0 100644 --- a/mrblib/array.rb +++ b/mrblib/array.rb @@ -11,7 +11,7 @@ class Array # # ISO 15.2.12.5.10 def each(&block) - return to_enum :each unless block_given? + return to_enum :each unless block idx = 0 while idx < length @@ -27,7 +27,7 @@ class Array # # ISO 15.2.12.5.11 def each_index(&block) - return to_enum :each_index unless block_given? + return to_enum :each_index unless block idx = 0 while idx < length @@ -44,7 +44,7 @@ class Array # # ISO 15.2.12.5.7 def collect!(&block) - return to_enum :collect! unless block_given? + return to_enum :collect! unless block self.each_index { |idx| self[idx] = block.call(self[idx]) } self -- cgit v1.2.3