Module: Jstdutil::RedGreen::Color
- Defined in:
- lib/jstdutil/redgreen.rb
Overview
Borrowed from the ruby redgreen gem Not included as a gem dependency since it drags in Test::Unit and friends, which is overkill for our situation
Constant Summary collapse
- COLORS =
{ :clear => 0, :bright => 1, :red => 31, :green => 32, :yellow => 33 }
Class Method Summary collapse
Class Method Details
.color(color) ⇒ Object
21 22 23 |
# File 'lib/jstdutil/redgreen.rb', line 21 def self.color(color) "\e[#{COLORS[color.to_sym]}m" end |
.method_missing(color_name, *args) ⇒ Object
17 18 19 |
# File 'lib/jstdutil/redgreen.rb', line 17 def self.method_missing(color_name, *args) color(:bright) + color(color_name) + args.first + color(:clear) end |