Class: FileScanners::Ignorer

Inherits:
Object
  • Object
show all
Defined in:
lib/file_scanners/ignorer.rb

Overview

Takes a list of files and ignores them appropriately

Constant Summary collapse

DEFAULT_IGNORES =
%w[/test/ /spec/ /db/ /config/ /bin/ /vendor/ /public/].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Ignorer

Returns a new instance of Ignorer.



8
9
10
# File 'lib/file_scanners/ignorer.rb', line 8

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/file_scanners/ignorer.rb', line 7

def path
  @path
end

Instance Method Details

#ignore?(file) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
# File 'lib/file_scanners/ignorer.rb', line 12

def ignore?(file)
  ignore_rules.each do |rule|
    return true if rule === file
  end
  false
end