diff options
| author | ksss <[email protected]> | 2014-03-23 20:11:20 +0900 |
|---|---|---|
| committer | ksss <[email protected]> | 2014-03-23 20:11:20 +0900 |
| commit | d8fc05fcb9c6161f4c0959e2e2471f597483e0f4 (patch) | |
| tree | a63b3edcffa52fe6ffa70ad8b675f8d1ca421b51 | |
| parent | b0f10b5c3db289275e127e3979f84fd567158b21 (diff) | |
| download | mruby-d8fc05fcb9c6161f4c0959e2e2471f597483e0f4.tar.gz mruby-d8fc05fcb9c6161f4c0959e2e2471f597483e0f4.zip | |
Hash#{reject,reject!} support return Enumerator
| -rw-r--r-- | mrblib/hash.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mrblib/hash.rb b/mrblib/hash.rb index 491d2a0ee..4b74550e7 100644 --- a/mrblib/hash.rb +++ b/mrblib/hash.rb @@ -134,6 +134,8 @@ class Hash # 1.8/1.9 Hash#reject! returns Hash; ISO says nothing. def reject!(&b) + return to_enum :reject! unless block_given? + keys = [] self.each_key{|k| v = self[k] @@ -150,6 +152,8 @@ class Hash # 1.8/1.9 Hash#reject returns Hash; ISO says nothing. def reject(&b) + return to_enum :reject unless block_given? + h = {} self.each_key{|k| v = self[k] |
