Class: Difftastic::ANSI
- Inherits:
-
Object
- Object
- Difftastic::ANSI
- Defined in:
- lib/difftastic/ansi.rb
Constant Summary collapse
- RED =
"\e[91;1m"- GREEN =
"\e[92;1m"- RESET =
"\e[0m"
Class Method Summary collapse
- .green(string = "") ⇒ Object
- .red(string = "") ⇒ Object
- .reset(string = "") ⇒ Object
- .strip_formatting(string) ⇒ Object
Class Method Details
.green(string = "") ⇒ Object
8 9 10 |
# File 'lib/difftastic/ansi.rb', line 8 def self.green(string = "") "#{GREEN}#{string}" end |
.red(string = "") ⇒ Object
12 13 14 |
# File 'lib/difftastic/ansi.rb', line 12 def self.red(string = "") "#{RED}#{string}" end |
.reset(string = "") ⇒ Object
16 17 18 |
# File 'lib/difftastic/ansi.rb', line 16 def self.reset(string = "") "#{RESET}#{string}" end |
.strip_formatting(string) ⇒ Object
20 21 22 |
# File 'lib/difftastic/ansi.rb', line 20 def self.strip_formatting(string) string.to_s.gsub(/\e\[[0-9;]*m/, "") end |