diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-03-14 02:41:22 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-03-14 02:41:22 +0900 |
| commit | 113ab607846e63c0348758d3e13017e0ea3a45a3 (patch) | |
| tree | 379aa985de0a4c1a148bc693b2207eaf66d44bc3 /mrblib/hash.rb | |
| parent | 463c5f83c3e5f379d4dd59deb17179915fbaf93b (diff) | |
| download | mruby-113ab607846e63c0348758d3e13017e0ea3a45a3.tar.gz mruby-113ab607846e63c0348758d3e13017e0ea3a45a3.zip | |
mruby-enumerator: move definitions in core_mod.rb to mrblib core
Diffstat (limited to 'mrblib/hash.rb')
| -rw-r--r-- | mrblib/hash.rb | 4 |
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 |
