class FileScanner::Filters::MatchingName
Public Class Methods
new(regexp = nil)
click to toggle source
# File lib/file_scanner/filters.rb, line 25 def initialize(regexp = nil) @regexp = compile(regexp) end
Public Instance Methods
call(file)
click to toggle source
# File lib/file_scanner/filters.rb, line 29 def call(file) return unless @regexp File.basename(file).matches?(@regexp) end
Private Instance Methods
compile(regexp)
click to toggle source
# File lib/file_scanner/filters.rb, line 34 def compile(regexp) return unless regexp Regexp.compile(regexp.to_s) end