Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #582 from kostya/find_index
enumerable#find_index
  • Loading branch information
alex committed Apr 9, 2013
2 parents 860ba37 + 3e07903 commit f97e8ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 8 additions & 0 deletions lib-topaz/enumerable.rb
Expand Up @@ -264,4 +264,12 @@ def group_by(&block)
end
h
end

def find_index(obj = nil, &block)
return self.enum_for(:find_index) if !obj && !block
each_with_index do |e, i|
return i if obj ? (e == obj) : block.call(e)
end
nil
end
end
8 changes: 0 additions & 8 deletions spec/tags/core/enumerable/find_index_tags.txt

This file was deleted.

0 comments on commit f97e8ca

Please sign in to comment.