Module: CodeOwnership::Mapper

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.allObject



23
24
25
# File 'lib/code_ownership/mapper.rb', line 23

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

.included(base) ⇒ Object



16
17
18
19
20
# File 'lib/code_ownership/mapper.rb', line 16

def included(base)
  @mappers ||= T.let(@mappers, T.nilable(T::Array[T::Class[Mapper]]))
  @mappers ||= []
  @mappers << base
end

.to_glob_cacheObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/code_ownership/mapper.rb', line 61

def self.to_glob_cache
  glob_to_owner_map_by_mapper_description = {}

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

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

      glob_to_owner_map_by_mapper_description.fetch(mapper.description)[glob] = owner
    end
  end

  Private::GlobCache.new(glob_to_owner_map_by_mapper_description)
end

Instance Method Details

#bust_caches!Object



58
# File 'lib/code_ownership/mapper.rb', line 58

def bust_caches!; end

#descriptionObject



55
# File 'lib/code_ownership/mapper.rb', line 55

def description; end

#globs_to_owner(files) ⇒ Object



44
# File 'lib/code_ownership/mapper.rb', line 44

def globs_to_owner(files); end

#map_file_to_owner(file) ⇒ Object



35
# File 'lib/code_ownership/mapper.rb', line 35

def map_file_to_owner(file); end

#update_cache(cache, files) ⇒ Object



52
# File 'lib/code_ownership/mapper.rb', line 52

def update_cache(cache, files); end