Module: FeatureMap::Mapper
- Included in:
- Private::AssignmentMappers::DirectoryAssignment, Private::AssignmentMappers::FeatureDefinitionAssignment, Private::AssignmentMappers::FeatureGlobs, Private::AssignmentMappers::FileAnnotations
- Defined in:
- lib/feature_map/mapper.rb
Class Method Summary collapse
Instance Method Summary collapse
- #bust_caches! ⇒ Object
- #description ⇒ Object
-
#globs_to_feature(files) ⇒ Object
This should be fast when run with MANY files.
-
#map_file_to_feature(file) ⇒ Object
This should be fast when run with ONE file.
-
#update_cache(cache, files) ⇒ Object
This should be fast when run with MANY files.
Class Method Details
.all ⇒ Object
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_cache ⇒ Object
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 |
#description ⇒ Object
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 |