Class: FileScanner::Filters::MatchingName

Inherits:
Object
  • Object
show all
Defined in:
lib/file_scanner/filters.rb

Instance Method Summary collapse

Constructor Details

#initialize(regexp = nil) ⇒ MatchingName

Returns a new instance of MatchingName.



25
26
27
# File 'lib/file_scanner/filters.rb', line 25

def initialize(regexp = nil)
  @regexp = compile(regexp)
end

Instance Method Details

#call(file) ⇒ Object



29
30
31
32
# File 'lib/file_scanner/filters.rb', line 29

def call(file)
  return unless @regexp
  File.basename(file).matches?(@regexp)
end