Sha256: a840a613d0f904ba38fbe2e9b65fcd3974d8c22b7ddf3c77041ddaf062f7b06f

Contents?: true

Size: 730 Bytes

Versions: 22

Compression:

Stored size: 730 Bytes

Contents

class FileFinder
  
  def initialize(finder, dir)
    @finder = finder
    @dir = dir
    @filters = []
  end
  
  def add_filter(filter)
    @filters << filter
  end
  
  def find
    
    # Refactor in detecting changes from previous all files list
    # Refactor in ability to ignore certain dirs/files (.svn etc)
    # Refactor detecting modified files
    
    all_files = []
    filtered_files = []

    @finder.find(@dir) do |path|
      all_files << path
      
      keep = @filters.inject(true) { |k, filter| k && filter.filter(path)  }
      filtered_files << path if keep
    end
    
    @filters.each do |filter|
      filter.complete
    end

    return { :all => all_files, :filtered => filtered_files }
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
loris-0.5.2 lib/file_finder.rb
loris-0.5.1 lib/file_finder.rb
loris-0.5.0 lib/file_finder.rb
loris-0.4.1 lib/file_finder.rb
loris-0.4.0 lib/file_finder.rb
loris-0.3.2 lib/file_finder.rb
loris-0.3.1 lib/file_finder.rb
loris-0.3.0 lib/file_finder.rb
loris-0.2.3 lib/file_finder.rb
loris-0.2.2 lib/file_finder.rb
loris-0.2.1 lib/file_finder.rb
loris-0.2.0 lib/file_finder.rb
loris-0.1.7 lib/file_finder.rb
loris-0.1.5 lib/file_finder.rb
loris-0.1.4 lib/file_finder.rb
loris-0.1.3 lib/file_finder.rb
loris-0.1.2 lib/file_finder.rb
loris-0.1.1 lib/file_finder.rb
loris-0.1.0 lib/file_finder.rb
loris-0.0.16 lib/file_finder.rb