mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Compute stats once
This commit is contained in:
@@ -3,6 +3,7 @@ module Linguist
|
|||||||
def initialize(paths)
|
def initialize(paths)
|
||||||
@paths = paths
|
@paths = paths
|
||||||
|
|
||||||
|
@computed_stats = false
|
||||||
@language = @size = nil
|
@language = @size = nil
|
||||||
@sizes = Hash.new { 0 }
|
@sizes = Hash.new { 0 }
|
||||||
end
|
end
|
||||||
@@ -27,6 +28,8 @@ module Linguist
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compute_stats
|
def compute_stats
|
||||||
|
return if @computed_stats
|
||||||
|
|
||||||
@paths.each do |path, blob|
|
@paths.each do |path, blob|
|
||||||
next if blob.vendored? || blob.generated?
|
next if blob.vendored? || blob.generated?
|
||||||
|
|
||||||
@@ -43,7 +46,7 @@ module Linguist
|
|||||||
@language = primary[0]
|
@language = primary[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
nil
|
@computed_stats = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user