Class: CodeOwnership::Private::GlobCache

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/code_ownership/private/glob_cache.rb

Constant Summary collapse

MapperDescription =
T.type_alias { String }
CacheShape =
T.type_alias do
  T::Hash[
    MapperDescription,
    GlobsToOwningTeamMap
  ]
end
FilesByMapper =
T.type_alias do
  T::Hash[
    String,
    T::Set[MapperDescription]
  ]
end

Instance Method Summary collapse

Constructor Details

#initialize(raw_cache_contents) ⇒ GlobCache

Returns a new instance of GlobCache.



26
27
28
# File 'lib/code_ownership/private/glob_cache.rb', line 26

def initialize(raw_cache_contents)
  @raw_cache_contents = raw_cache_contents
end

Instance Method Details

#mapper_descriptions_that_map_files(files) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/code_ownership/private/glob_cache.rb', line 36

def mapper_descriptions_that_map_files(files)
  files_by_mappers = files.to_h { |f| [f, Set.new([])] }

  files_by_mappers_via_expanded_cache.each do |file, mappers|
    mappers.each do |mapper|
      T.must(files_by_mappers[file]) << mapper if files_by_mappers[file]
    end
  end

  files_by_mappers
end

#raw_cache_contentsObject



31
32
33
# File 'lib/code_ownership/private/glob_cache.rb', line 31

def raw_cache_contents
  @raw_cache_contents
end