2 3 4 5 6 7 8 9 10 11 12 13 14
# File 'lib/grep.rb', line 2 def grep(re) res = [] require 'find' Find.find(path) do |f| if File.file? f File.open(f) do |io| res += io.grep(re) end end end res end