Skip to content
Browse files

revert to using static color methods

  • Loading branch information...
1 parent 248004e commit 7cdd88b33a48563229083b0710237a25c69179a2 @alexcoplan alexcoplan committed
Showing with 10 additions and 9 deletions.
  1. +10 −9 lib/rspec/expectations/differ.rb
View
19 lib/rspec/expectations/differ.rb
@@ -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)

0 comments on commit 7cdd88b

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