Class: TestChanges::IgnoreExcludedFilesService

Inherits:
Object
  • Object
show all
Defined in:
lib/test_changes/ignore_excluded_files_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exclusion_patterns) ⇒ IgnoreExcludedFilesService

Returns a new instance of IgnoreExcludedFilesService.



5
6
7
# File 'lib/test_changes/ignore_excluded_files_service.rb', line 5

def initialize(exclusion_patterns)
  @exclusion_patterns = exclusion_patterns || []
end

Instance Attribute Details

#exclusion_patternsObject (readonly)

Returns the value of attribute exclusion_patterns.



3
4
5
# File 'lib/test_changes/ignore_excluded_files_service.rb', line 3

def exclusion_patterns
  @exclusion_patterns
end

Instance Method Details

#call(paths) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/test_changes/ignore_excluded_files_service.rb', line 9

def call(paths)
  matching_paths = exclusion_patterns.flat_map do |pattern|
    Pathname.glob(pattern)
  end

  paths - matching_paths.map(&:to_s)
end