Class: Nandi::FileMatcher
- Inherits:
-
Object
- Object
- Nandi::FileMatcher
- Defined in:
- lib/nandi/file_matcher.rb
Constant Summary collapse
- TIMESTAMP_REGEX =
/\A(?<operator>>|>=)?(?<timestamp>\d+)\z/
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(files:, spec:) ⇒ FileMatcher
constructor
A new instance of FileMatcher.
Constructor Details
#initialize(files:, spec:) ⇒ FileMatcher
Returns a new instance of FileMatcher.
11 12 13 14 |
# File 'lib/nandi/file_matcher.rb', line 11 def initialize(files:, spec:) @files = Set.new(files) @spec = spec end |
Class Method Details
.call(*args, **kwargs) ⇒ Object
7 8 9 |
# File 'lib/nandi/file_matcher.rb', line 7 def self.call(*args, **kwargs) new(*args, **kwargs).call end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/nandi/file_matcher.rb', line 16 def call case spec when "all" Set.new( files.reject { |f| ignored_filenames.include?(File.basename(f)) }, ) when "git-diff" files.intersection(files_from_git_status) when TIMESTAMP_REGEX end end |