Class: CiToolkit::DuplicateFilesFinder
- Inherits:
-
Object
- Object
- CiToolkit::DuplicateFilesFinder
- Defined in:
- lib/ci_toolkit/duplicate_files_finder.rb
Overview
Finds duplicate files based on md5 hash
Instance Method Summary collapse
- #duplicate_groups ⇒ Object
-
#initialize(relative_search_path = nil, whitelist_file = nil, exclusion_patterns = []) ⇒ DuplicateFilesFinder
constructor
A new instance of DuplicateFilesFinder.
Constructor Details
#initialize(relative_search_path = nil, whitelist_file = nil, exclusion_patterns = []) ⇒ DuplicateFilesFinder
Returns a new instance of DuplicateFilesFinder.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ci_toolkit/duplicate_files_finder.rb', line 8 def initialize( relative_search_path = nil, whitelist_file = nil, exclusion_patterns = [] ) @base_dir = select_base_dir(relative_search_path) @whitelisted_files = create_whitelist_from_file(whitelist_file) || [] @exclusion_patterns = exclusion_patterns || [] @duplicated_files = [] duplicate_map = files_mapped_to_md5_checksum duplicate_map.each { |md5, duplicates| @duplicated_files << duplicates if duplicate_map[md5].count > 1 } end |
Instance Method Details
#duplicate_groups ⇒ Object
21 22 23 |
# File 'lib/ci_toolkit/duplicate_files_finder.rb', line 21 def duplicate_groups @duplicated_files end |