Class: CLI::ANSI
- Inherits:
-
Object
- Object
- CLI::ANSI
- Defined in:
- lib/ansi.rb
Class Method Summary collapse
- .blue(text = nil) ⇒ Object
- .clear ⇒ Object
- .clear_screen ⇒ Object
- .green(text = nil) ⇒ Object
- .red(text = nil) ⇒ Object
- .set_cursor(x = 1, y = 1) ⇒ Object
- .yellow(text = nil) ⇒ Object
Class Method Details
.blue(text = nil) ⇒ Object
17 18 19 20 21 |
# File 'lib/ansi.rb', line 17 def self.blue(text=nil) ret = "\033[34m" ret += "#{text}#{self.clear}" if text ret end |
.clear ⇒ Object
35 36 37 |
# File 'lib/ansi.rb', line 35 def self.clear "\033[0m" end |
.clear_screen ⇒ Object
7 8 9 |
# File 'lib/ansi.rb', line 7 def self.clear_screen puts "\033[1;2J" end |
.green(text = nil) ⇒ Object
23 24 25 26 27 |
# File 'lib/ansi.rb', line 23 def self.green(text=nil) ret = "\033[32m" ret += "#{text}#{self.clear}" if text ret end |
.red(text = nil) ⇒ Object
11 12 13 14 15 |
# File 'lib/ansi.rb', line 11 def self.red(text=nil) ret = "\033[31m" ret += "#{text}#{self.clear}" if text ret end |
.set_cursor(x = 1, y = 1) ⇒ Object
3 4 5 |
# File 'lib/ansi.rb', line 3 def self.set_cursor(x=1, y=1) puts "\033[1;#{x};#{y}H" end |
.yellow(text = nil) ⇒ Object
29 30 31 32 33 |
# File 'lib/ansi.rb', line 29 def self.yellow(text=nil) ret = "\033[33m" ret += "#{text}#{self.clear}" if text ret end |