summaryrefslogtreecommitdiff
path: root/tool/colorize.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-15 02:39:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-15 02:39:06 +0000
commitd25ed18c3defab09e71318baca5037541728c877 (patch)
tree01b98f339375c255bed445ebdab216287f004420 /tool/colorize.rb
parent95797e13d4a32d5ec3222f223b7d4a37d24a2452 (diff)
make-snapshot: colorize [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/colorize.rb')
-rw-r--r--tool/colorize.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/tool/colorize.rb b/tool/colorize.rb
index 6b9f568020..b840238e52 100644
--- a/tool/colorize.rb
+++ b/tool/colorize.rb
@@ -1,3 +1,5 @@
+# frozen-string-literal: true
+
class Colorize
def initialize(color = nil)
@colors = @reset = nil
@@ -11,7 +13,11 @@ class Colorize
self
end
- DEFAULTS = {"pass"=>"32;1", "fail"=>"31;1", "skip"=>"33;1"}
+ DEFAULTS = {
+ "pass"=>"32;1", "fail"=>"31;1", "skip"=>"33;1",
+ "black"=>"30", "red"=>"31", "green"=>"32", "yellow"=>"33",
+ "blue"=>"34", "magenta"=>"35", "cyan"=>"36", "white"=>"37",
+ }
def decorate(str, name)
if @colors and color = (@colors[name] || DEFAULTS[name])
@@ -21,16 +27,10 @@ class Colorize
end
end
- def pass(str)
- decorate(str, "pass")
- end
-
- def fail(str)
- decorate(str, "fail")
- end
-
- def skip(str)
- decorate(str, "skip")
+ DEFAULTS.each_key do |name|
+ define_method(name) {|str|
+ decorate(str, name)
+ }
end
end