Module: Ubalo::Color
- Defined in:
- lib/ubalo/util.rb
Constant Summary collapse
- COLORS =
{:clear => 0, :red => 31, :green => 32, :yellow => 33, :blue => 34, :gray => 30, :grey => 30}
Class Method Summary collapse
Class Method Details
.color(color) ⇒ Object
135 136 137 |
# File 'lib/ubalo/util.rb', line 135 def self.color(color) "\e[#{COLORS[color.to_sym]}m" end |
.method_missing(color_name, *args) ⇒ Object
127 128 129 130 131 132 133 |
# File 'lib/ubalo/util.rb', line 127 def self.method_missing(color_name, *args) if args.first.is_a? String color(color_name) + args.first + color(:clear) else color(color_name) + args.first.inspect + color(:clear) end end |