Skip to content
Permalink
Browse files

Merge pull request #795 from kostya/rindex

fix Array#rindex
  • Loading branch information
alex committed Jul 12, 2013
2 parents 07e383c + 685534d commit 8ecbf96ba98bedaad2203857634115678307e403
Showing with 6 additions and 3 deletions.
  1. +6 −2 lib-topaz/array.rb
  2. +0 −1 spec/tags/core/array/rindex_tags.txt
@@ -336,8 +336,12 @@ def index(obj = nil, &block)

def rindex(obj = nil, &block)
return self.enum_for(:rindex) if !obj && !block
reverse.each_with_index do |e, i|
return length - i - 1 if obj ? (e == obj) : block.call(e)
i = size - 1
while i >= 0
e = self[i]
return i if obj ? (e == obj) : block.call(e)
i = size if i > size
i -= 1
end
nil
end

This file was deleted.

0 comments on commit 8ecbf96

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