Class: JetBlack::AnsiScrubber

Inherits:
Object
  • Object
show all
Defined in:
lib/jet_black/ansi_scrubber.rb

Constant Summary collapse

ESCAPE_SEQUENCE =
/
  \x1B # ESC char - start of the sequence
  (
    [\x20-\x2F]*
    [\x40-\x5A\x5C-\x7E]
    |
    \[           # Start CSI sequence
    [\x30-\x3F]+ # CSI Parameter bytes
    [\x20-\x2F]* # CSI Intermediate bytes
    [\x40-\x7E]  # CSI Finishing byte
  )
/x

Class Method Summary collapse

Class Method Details

.call(string) ⇒ Object



18
19
20
# File 'lib/jet_black/ansi_scrubber.rb', line 18

def self.call(string)
  string.gsub(ESCAPE_SEQUENCE, "")
end