Class: Guard::Git::ChangedFilesMatcher
- Inherits:
-
Object
- Object
- Guard::Git::ChangedFilesMatcher
- Defined in:
- lib/guard/git/changed_files_matcher.rb
Overview
Only matches files that both:
-
Match the passed-in pattern AND
-
Are either ignored by git or identified as changed
Instance Method Summary collapse
-
#initialize(pattern) ⇒ ChangedFilesMatcher
constructor
A new instance of ChangedFilesMatcher.
- #match(filename_or_pathname) ⇒ Object
Constructor Details
#initialize(pattern) ⇒ ChangedFilesMatcher
Returns a new instance of ChangedFilesMatcher.
10 11 12 |
# File 'lib/guard/git/changed_files_matcher.rb', line 10 def initialize(pattern) @pattern = pattern end |
Instance Method Details
#match(filename_or_pathname) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/guard/git/changed_files_matcher.rb', line 14 def match(filename_or_pathname) path = filename_or_pathname.to_s result = @pattern.match(path) return nil if result.nil? || skip_file?(path) result end |