Skip to content
Permalink
Browse files

Merge pull request #605 from kachick/implement-enumerable-reverse_each

Implement Enumerable#reverse_each
  • Loading branch information
alex committed Apr 11, 2013
2 parents 47a3a2b + 3730f42 commit a44c29f3e768c2fd0a3fc4917cada75406a55b9d
Showing with 6 additions and 2 deletions.
  1. +6 −0 lib-topaz/enumerable.rb
  2. +0 −2 spec/tags/core/enumerable/reverse_each_tags.txt
@@ -70,6 +70,12 @@ def each_entry(*args, &block)
self
end

def reverse_each(&block)
return self.enum_for(:reverse_each) unless block
self.to_a.reverse_each(&block)
self
end

def all?(&block)
self.each do |obj|
return false unless (block ? block.call(obj) : obj)
@@ -1,3 +1 @@
fails:Enumerable#reverse_each traverses enum in reverse order and pass each element to block
fails:Enumerable#reverse_each returns an Enumerator if no block given
fails:Enumerable#reverse_each gathers whole arrays as elements when each yields multiple

0 comments on commit a44c29f

Please sign in to comment.
You can’t perform that action at this time.