Class: FileScanner::Filters::MatchingName
- Inherits:
-
Object
- Object
- FileScanner::Filters::MatchingName
- Defined in:
- lib/file_scanner/filters.rb
Instance Method Summary collapse
- #call(file) ⇒ Object
-
#initialize(regexp = nil) ⇒ MatchingName
constructor
A new instance of MatchingName.
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 |