Module: Corefines::String::Decolor
- Defined in:
- lib/corefines/string.rb
Instance Method Summary collapse
-
#decolor ⇒ String
A copy of this string without ANSI escape codes (e.g. colors).
Instance Method Details
#decolor ⇒ String
Returns a copy of this string without ANSI escape codes (e.g. colors).
179 180 181 182 183 184 185 186 187 |
# File 'lib/corefines/string.rb', line 179 module Decolor refine ::String do def decolor scan(ESCAPE_SEQUENCE).reduce('') do |str, match| str << (match[3] || match[4]) end end end end |