Compute stats once

This commit is contained in:
Joshua Peek
2011-05-21 21:17:15 -05:00
parent bcd90d2746
commit b9d1e86eac

View File

@@ -3,6 +3,7 @@ module Linguist
def initialize(paths)
@paths = paths
@computed_stats = false
@language = @size = nil
@sizes = Hash.new { 0 }
end
@@ -27,6 +28,8 @@ module Linguist
end
def compute_stats
return if @computed_stats
@paths.each do |path, blob|
next if blob.vendored? || blob.generated?
@@ -43,7 +46,7 @@ module Linguist
@language = primary[0]
end
nil
@computed_stats = true
end
end
end