summaryrefslogtreecommitdiffhomepage
path: root/mrblib
diff options
context:
space:
mode:
Diffstat (limited to 'mrblib')
-rw-r--r--mrblib/enum.rb2
-rw-r--r--mrblib/kernel.rb2
2 files changed, 3 insertions, 1 deletions
diff --git a/mrblib/enum.rb b/mrblib/enum.rb
index aacc35651..38c51aa21 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)
diff --git a/mrblib/kernel.rb b/mrblib/kernel.rb
index fd4dc04ac..81d7acf5d 100644
--- a/mrblib/kernel.rb
+++ b/mrblib/kernel.rb
@@ -45,7 +45,7 @@ module Kernel
while(true)
yield
end
- rescue => StopIteration
+ rescue StopIteration
nil
end