Method: SimpleColor::Utilities#current_colors
- Defined in:
- lib/simplecolor.rb
#current_colors(s) ⇒ Object
get the ansi sequences on s (assume the whole line is colored) returns left_ansi, right_ansi, string
104 105 106 107 108 109 |
# File 'lib/simplecolor.rb', line 104 def current_colors(s) m=s.match(/^(#{Colorer.regexp(:match)})(.*?)(#{Colorer.regexp(:match)})$/) [m[1],m[3],m[2]] rescue ArgumentError #rescue from "invalid byte sequence in UTF-8" ["","",s] end |