Sha256: e93b667ee0815d84ee619cb5cb970cf4b944ce20daec8358718e05b02c1ef26b

Contents?: true

Size: 628 Bytes

Versions: 51

Compression:

Stored size: 628 Bytes

Contents

require 'pathname'

# TODO: extend this to find comments
# http://ostermiller.org/findcomment.html

module PathnameIterator
 def iterate(proc, &block)
   if directory?
     children.each do |c|
       c.iterate(proc)
     end
   else
     proc.call(self, &block)
   end
 end

 def egrep(regexp, &block)
   proc = Proc.new do |file|
     file.open do |io|
       count = 0
       while line = io.gets
         count += 1
         if line =~ regexp
           block.call("#{file.cleanpath}:#{count}:#{line}")
         end
       end
     end
   end
   iterate(proc, &block)
 end

end

class Pathname
 include PathnameIterator
end

Version data entries

51 entries across 51 versions & 3 rubygems

Version Path
redcar-dev-0.12.1dev-java lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-dev-0.12.0dev-java lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.11 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.11.0dev lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.10 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.9.2 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.9.1 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.9.0 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.8.1 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.8 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.7 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.6.1 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.6 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.6.1dev lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.5.1 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.5 lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.5.6dev lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.5.5dev lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.5.4dev lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb
redcar-0.5.3dev lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb