Method: Pry::Helpers::Text#strip_color

Defined in:
lib/pry/helpers/text.rb

#strip_color(text) ⇒ String

Remove any color codes from text.

Parameters:

  • text (String, #to_s)

Returns:

  • (String)

    text stripped of any color codes.



46
47
48
# File 'lib/pry/helpers/text.rb', line 46

def strip_color(text)
  text.to_s.gsub(/(\001)?(\e\[(\d[;\d]?)*m)(\002)?/, '')
end