class Gitenv::FilesMatcher

Public Class Methods

new(options = {}) click to toggle source
# File lib/gitenv/files/matcher.rb, line 3
def initialize(options = {})
  @options = options
  @ignores = options[:ignores] ? [options[:ignores]].flatten : []
end

Public Instance Methods

except(*args) click to toggle source
# File lib/gitenv/files/matcher.rb, line 12
def except *args
  @ignores.concat args
  self
end
files(path) click to toggle source
# File lib/gitenv/files/matcher.rb, line 8
def files(path)
  ignore Dir.entries(path)
end

Private Instance Methods

ignore(entries) click to toggle source
# File lib/gitenv/files/matcher.rb, line 19
def ignore(entries)
  entries.reject { |e| @ignores.any? { |g| g == e or (g.is_a?(Regexp) and e.match(g)) } }
end