Module: Terminal::Table::Util
- Defined in:
- lib/kramdown/ansi.rb
Overview
A utility module that provides ANSI escape sequence removal functionality for terminal table content.
The Terminal::Table::Util module contains helper methods for processing text that may contain ANSI escape sequences, particularly for cleaning up terminal table output before further processing or display.
Class Method Summary collapse
-
.ansi_escape(line) ⇒ String
Removes ANSI escape sequences from the given line of text.
Class Method Details
.ansi_escape(line) ⇒ String
Removes ANSI escape sequences from the given line of text.
This method strips out all ANSI escape codes that are commonly used to format terminal output with colors, styles, and cursor movements.
sequences sequences removed
58 59 60 |
# File 'lib/kramdown/ansi.rb', line 58 def self.ansi_escape(line) line.to_s.gsub(/\e\[.*?m|\e\].*?(\e|\a)\\?/, '') end |