Class: AllTypesRepository
- Inherits:
-
Linguist::Repository
- Object
- Linguist::Repository
- AllTypesRepository
- Defined in:
- lib/git-branch_stats.rb
Overview
Repostiory that calculates sizes for all types (markup AND programming) Since this analyzer is for branches, we want to have precise reporting on what has been done, not just programming
Instance Method Summary collapse
Instance Method Details
#compute_stats ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/git-branch_stats.rb', line 28 def compute_stats return if @computed_stats @enum.each do |blob| # Skip files that are likely binary next if blob.likely_binary? # Skip vendored or generated blobs next if blob.vendored? || blob.generated? || blob.language.nil? @sizes[blob.language.group] += blob.size end # Compute total size @size = @sizes.inject(0) { |s,(_,v)| s + v } # Get primary language if primary = @sizes.max_by { |(_, size)| size } @language = primary[0] end @computed_stats = true nil end |