Sha256: 11800f5ca3cfe0b2490111873c4e4206632657de4a4812c1be078d7262f65f3c

Contents?: true

Size: 452 Bytes

Versions: 4

Compression:

Stored size: 452 Bytes

Contents

module Gitenv

  class FilesMatcher

    def initialize options = {}
      @options = options
      @ignores = options[:ignores] ? [ options[:ignores] ].flatten : []
    end

    def files path
      ignore Dir.entries(path)
    end

    def except *args
      @ignores.concat args
      self
    end

    private

    def ignore entries
      entries.reject{ |e| @ignores.any?{ |g| g == e or (g.kind_of?(Regexp) and e.match(g)) } }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gitenv-1.0.0 lib/gitenv/files/matcher.rb
gitenv-0.3.0 lib/gitenv/files/matcher.rb
gitenv-0.2.0 lib/gitenv/files/matcher.rb
gitenv-0.1.0 lib/gitenv/files/matcher.rb