mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Hash#{reject,reject!} support return Enumerator
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user