Skip to content

Commit

Permalink
revert to using static color methods
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcoplan committed Aug 25, 2012
1 parent 248004e commit 7cdd88b
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/rspec/expectations/differ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ def color(text, color_code)
"\e[#{color_code}m#{text}\e[0m"
end

# define methods for each color name
{
:red => 31,
:green => 32,
:blue => 34
}.each do |color_name, color_code|
define_method color_name do |text|
color(text, color_code)
end
def red(text)
color(text, 31)
end

def green(text)
color(text, 32)
end

def blue(text)
color(text, 34)
end

def color_diff(diff)
Expand Down

0 comments on commit 7cdd88b

Please sign in to comment.