Class: TestMap::Mapping

Inherits:
Data
  • Object
show all
Defined in:
lib/test_map/mapping.rb

Overview

Mapping looksup test files for changed files.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#map_fileObject (readonly)

Returns the value of attribute map_file

Returns:

  • (Object)

    the current value of map_file



7
8
9
# File 'lib/test_map/mapping.rb', line 7

def map_file
  @map_file
end

Instance Method Details

#apply_natural_mapping(files) ⇒ Object



15
16
17
# File 'lib/test_map/mapping.rb', line 15

def apply_natural_mapping(files)
  files.map { |file| NaturalMapping.new(file).test_files }
end

#lookup(*changed_files) ⇒ Object



10
11
12
13
# File 'lib/test_map/mapping.rb', line 10

def lookup(*changed_files)
  new_files = apply_natural_mapping(changed_files - map.keys)
  map.values_at(*changed_files).concat(new_files).flatten.compact.uniq
end

#mapObject



8
# File 'lib/test_map/mapping.rb', line 8

def map = YAML.safe_load_file(map_file)