Permalink
Browse files

Highlight improvement with yellow if +-5%

  • Loading branch information...
1 parent 11d7cc4 commit 3e442ba05744913f913b368436424b5b682ce86b @bogdan committed May 24, 2012
Showing with 3 additions and 5 deletions.
  1. +3 −5 lib/diffbench.rb
View
@@ -8,7 +8,7 @@
class DiffBench
class Runner
- COLORS = {red: 31, green: 32}
+ COLORS = {:red => 31, :green => 32, :yellow => 33}
def initialize(file, *args)
@file = file
@@ -54,9 +54,7 @@ def run
color_string = result_color(improvement)
output "After patch: #{after_patch.format}"
output "Before patch: #{before_patch.format}"
- if color_string
- output self.class.color("Improvement: #{improvement}%", color_string).strip
- end
+ output self.class.color("Improvement: #{improvement}%", color_string).strip
output ""
end
end
@@ -78,7 +76,7 @@ def self.color_enabled?
def result_color(improvement)
if (-5..5).include?(improvement)
- nil
+ :yellow
else
improvement > 0 ? :green : :red
end

0 comments on commit 3e442ba

Please sign in to comment.