Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Highlight improvement with yellow if +-5%

  • Loading branch information...
commit 3e442ba05744913f913b368436424b5b682ce86b 1 parent 11d7cc4
Bogdan Gusiev authored May 24, 2012

Showing 1 changed file with 3 additions and 5 deletions. Show diff stats Hide diff stats

  1. 8  lib/diffbench.rb
8  lib/diffbench.rb
@@ -8,7 +8,7 @@
8 8
 class DiffBench
9 9
 
10 10
   class Runner
11  
-    COLORS = {red: 31, green: 32}
  11
+    COLORS = {:red => 31, :green => 32, :yellow => 33}
12 12
 
13 13
     def initialize(file, *args)
14 14
       @file = file
@@ -54,9 +54,7 @@ def run
54 54
         color_string = result_color(improvement)
55 55
         output "After patch:  #{after_patch.format}"
56 56
         output "Before patch: #{before_patch.format}"
57  
-        if color_string
58  
-          output self.class.color("Improvement: #{improvement}%", color_string).strip
59  
-        end
  57
+        output self.class.color("Improvement: #{improvement}%", color_string).strip
60 58
         output ""
61 59
       end
62 60
     end
@@ -78,7 +76,7 @@ def self.color_enabled?
78 76
 
79 77
     def result_color(improvement)
80 78
       if (-5..5).include?(improvement)
81  
-        nil
  79
+        :yellow
82 80
       else
83 81
         improvement > 0 ? :green : :red
84 82
       end

0 notes on commit 3e442ba

Please sign in to comment.
Something went wrong with that request. Please try again.