module BB::String
String
utilities.
Public Class Methods
strip_ansi(text)
click to toggle source
Strip ANSI escape sequences from String
.
@param [String] text Input string (dirty) @return [String] Output string (cleaned)
# File lib/blackbox/string.rb, line 11 def strip_ansi(text) text.gsub(/\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]/, '') .gsub(/\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]/, '') .gsub(/(\x03|\x1a)/, '') end