module Aruba::Api::Text

def extract_text(text)

Parameters:
  • text (#to_s) --
def extract_text(text)
  text
    .gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, "")
    .gsub(/\\\[|\\\]/, "")
    .gsub(/\007|\016|\017/, "")
end

def sanitize_text(text)

Parameters:
  • text (#to_s) --
def sanitize_text(text)
  text = unescape_text(text)
  text = extract_text(text) if aruba.config.remove_ansi_escape_sequences
  text.chomp
end

def unescape_text(text)

Parameters:
  • text (#to_s) --
def unescape_text(text)
  text
    .gsub('\n', "\n")
    .gsub('\"', '"')
    .gsub('\e', "\e")
    .gsub('\033', "\e")
    .gsub('\016', "\016")
    .gsub('\017', "\017")
    .gsub('\t', "\t")
end