Commit 5e4626c9 authored by ksss's avatar ksss

Hash#{select,select!} support return Enumerator

if non block given
parent ff666663
......@@ -162,6 +162,8 @@ class Hash
# 1.9 Hash#select! returns Hash; ISO says nothing.
def select!(&b)
return to_enum :select! unless block_given?
keys = []
self.each_key{|k|
v = self[k]
......@@ -178,6 +180,8 @@ class Hash
# 1.9 Hash#select returns Hash; ISO says nothing.
def select(&b)
return to_enum :select unless block_given?
h = {}
self.each_key{|k|
v = self[k]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment