diff options
author | Georg G <nilsding@nilsding.org> | 2016-10-10 16:18:26 +0200 |
---|---|---|
committer | Georg G <nilsding@nilsding.org> | 2016-10-10 16:18:26 +0200 |
commit | 09ccf6cce3e191f5971c96f1ce8b227a8f3682af (patch) | |
tree | ef5f10e519ab0b981bc0429418e7ce572cf378f9 /app/controllers/projects/graphs_controller.rb | |
parent | 3530489761fbf892adbf335fe65c0c73b978da39 (diff) | |
download | gitlab-ce-09ccf6cce3e191f5971c96f1ce8b227a8f3682af.tar.gz |
Use Linguist::Language[] instead of creating a hash
Diffstat (limited to 'app/controllers/projects/graphs_controller.rb')
-rw-r--r-- | app/controllers/projects/graphs_controller.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/app/controllers/projects/graphs_controller.rb b/app/controllers/projects/graphs_controller.rb index f4f2e5841a0..923e7340e69 100644 --- a/app/controllers/projects/graphs_controller.rb +++ b/app/controllers/projects/graphs_controller.rb @@ -35,14 +35,10 @@ class Projects::GraphsController < Projects::ApplicationController def languages @languages = Linguist::Repository.new(@repository.rugged, @repository.rugged.head.target_id).languages total = @languages.map(&:last).sum - colors = Linguist::Language.colors. - select { |lang| @languages.include? lang.name }. - map { |lang| [lang.name, lang.color] }. - to_h @languages = @languages.map do |language| name, share = language - color = colors[name] || "##{Digest::SHA256.hexdigest(name)[0...6]}" + color = Linguist::Language[name].color || "##{Digest::SHA256.hexdigest(name)[0...6]}" { value: (share.to_f * 100 / total).round(2), label: name, |