From 9abe413530431660b274acb7273ef1f1f23771c7 Mon Sep 17 00:00:00 2001 From: ksss Date: Mon, 17 Mar 2014 22:31:40 +0900 Subject: Enumrable#each_with_index return Enumerator if non block given --- mrblib/enum.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mrblib/enum.rb') diff --git a/mrblib/enum.rb b/mrblib/enum.rb index 5a33ed3c5..04a27294c 100644 --- a/mrblib/enum.rb +++ b/mrblib/enum.rb @@ -108,6 +108,8 @@ module Enumerable # # ISO 15.3.2.2.5 def each_with_index(&block) + return to_enum :each_with_index unless block_given? + i = 0 self.each{|*val| block.call(val.__svalue, i) -- cgit v1.2.3