Module: FeatureMap::Mapper

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.allObject



12
13
14
# File 'lib/feature_map/mapper.rb', line 12

def all
  (@mappers || []).map(&:new)
end

.included(base) ⇒ Object



7
8
9
10
# File 'lib/feature_map/mapper.rb', line 7

def included(base)
  @mappers ||= []
  @mappers << base
end

.to_glob_cacheObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/feature_map/mapper.rb', line 36

def self.to_glob_cache
  glob_to_feature_map_by_mapper_description = {}

  Mapper.all.each do |mapper|
    mapped_files = mapper.globs_to_feature(Private.tracked_files)
    glob_to_feature_map_by_mapper_description[mapper.description] ||= {}

    mapped_files.each do |glob, feature|
      next if feature.nil?

      glob_to_feature_map_by_mapper_description.fetch(mapper.description)[glob] = feature
    end
  end

  Private::GlobCache.new(glob_to_feature_map_by_mapper_description)
end

Instance Method Details

#bust_caches!Object



34
# File 'lib/feature_map/mapper.rb', line 34

def bust_caches!; end

#descriptionObject



32
# File 'lib/feature_map/mapper.rb', line 32

def description; end

#globs_to_feature(files) ⇒ Object

This should be fast when run with MANY files



25
# File 'lib/feature_map/mapper.rb', line 25

def globs_to_feature(files); end

#map_file_to_feature(file) ⇒ Object

This should be fast when run with ONE file



20
# File 'lib/feature_map/mapper.rb', line 20

def map_file_to_feature(file); end

#update_cache(cache, files) ⇒ Object

This should be fast when run with MANY files



30
# File 'lib/feature_map/mapper.rb', line 30

def update_cache(cache, files); end