Module: LeftRight::C
- Defined in:
- lib/leftright/color.rb
Class Method Summary collapse
- .bold(string = nil) ⇒ Object
- .color(string = nil, code = nil) ⇒ Object
- .cyan(string = nil) ⇒ Object
- .green(string = nil) ⇒ Object
- .red(string = nil) ⇒ Object
- .reset(string = nil) ⇒ Object
- .yellow(string = nil) ⇒ Object
Class Method Details
.bold(string = nil) ⇒ Object
19 20 21 |
# File 'lib/leftright/color.rb', line 19 def self.bold(string = nil) color string, 1 end |
.color(string = nil, code = nil) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/leftright/color.rb', line 7 def self.color(string = nil, code = nil) if ::LeftRight::tty? string.nil? ? "\e[#{code}m" : "\e[#{code}m" + string + "\e[0m" else string || '' end end |
.cyan(string = nil) ⇒ Object
35 36 37 |
# File 'lib/leftright/color.rb', line 35 def self.cyan(string = nil) color string, 36 end |
.green(string = nil) ⇒ Object
27 28 29 |
# File 'lib/leftright/color.rb', line 27 def self.green(string = nil) color string, 32 end |
.red(string = nil) ⇒ Object
23 24 25 |
# File 'lib/leftright/color.rb', line 23 def self.red(string = nil) color string, 31 end |
.reset(string = nil) ⇒ Object
15 16 17 |
# File 'lib/leftright/color.rb', line 15 def self.reset(string = nil) color string, 0 end |
.yellow(string = nil) ⇒ Object
31 32 33 |
# File 'lib/leftright/color.rb', line 31 def self.yellow(string = nil) color string, 33 end |