Method: Colsole.process_color_markers
- Defined in:
- lib/colsole.rb
.process_color_markers(string) ⇒ Object
117 118 119 120 121 122 123 124 |
# File 'lib/colsole.rb', line 117 def process_color_markers(string) string.gsub(/([rgybmcn])([ubi]{0,3})`([^`]*)`/) do color = ANSI_COLORS[$1] styles = $2.chars.map { |a| ANSI_STYLES[a] }.join text = $3 yield color, styles, text end end |