Array#reverse_each should return Enumerator; ref #1968

parent 56251042
...@@ -204,6 +204,8 @@ class Array ...@@ -204,6 +204,8 @@ class Array
# for efficiency # for efficiency
def reverse_each(&block) def reverse_each(&block)
return to_enum :sort_by unless block_given?
i = self.size - 1 i = self.size - 1
while i>=0 while i>=0
block.call(self[i]) block.call(self[i])
......
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