summaryrefslogtreecommitdiffhomepage
path: root/mrblib/hash.rb
diff options
context:
space:
mode:
Diffstat (limited to 'mrblib/hash.rb')
-rw-r--r--mrblib/hash.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/mrblib/hash.rb b/mrblib/hash.rb
index fae44e6f0..c15f770f7 100644
--- a/mrblib/hash.rb
+++ b/mrblib/hash.rb
@@ -43,7 +43,9 @@ class Hash
#
# ISO 15.2.13.4.9
def each(&block)
- self.keys.each{|k| block.call([k, self[k]])}
+ return to_enum :each unless block_given?
+
+ self.keys.each { |k| block.call [k, self[k]] }
self
end