Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:topazproject/topaz

  • Loading branch information
Alex Gaynor
Alex Gaynor committed Apr 14, 2013
2 parents 67b6ff5 + 8556ee3 commit cb0e65c95a52355f48f1902385b3dc9e32b5d410
Showing with 18 additions and 3 deletions.
  1. +18 −0 lib-topaz/enumerable.rb
  2. +0 −3 spec/tags/core/enumerable/grep_tags.txt
@@ -419,4 +419,22 @@ def cycle(n = nil, &block)
end
end
end

def grep(pattern, &block)
ret = []
if block
self.each do |elm|
if pattern === elm
ret << yield(elm)
end
end
else
self.each do |elm|
if pattern === elm
ret << elm
end
end
end
ret
end
end
@@ -1,4 +1 @@
fails:Enumerable#grep grep without a block should return an array of all elements === pattern
fails:Enumerable#grep grep with a block should return an array of elements === pattern passed through block
fails:Enumerable#grep grep the enumerable (rubycon legacy)
fails:Enumerable#grep can use $~ in the block when used with a Regexp

0 comments on commit cb0e65c

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