Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/coloring.rb
Overview
gem Colorize is a great tool, but I don’t want add dependencies to Canoe
Class Method Summary collapse
Class Method Details
.define_coloring_methods ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/coloring.rb', line 4 def self.define_coloring_methods colors = { 30 => :black, 31 => :red, 32 => :green, 33 => :yellow, 34 => :blue, 35 => :magenta, 36 => :cyan, 37 => :white } colors.each do |k, v| define_method v do "\033[#{k}m#{self}\033[0m" end end end |