Class: Logsaber::SimpleColor
- Inherits:
-
Object
- Object
- Logsaber::SimpleColor
- Defined in:
- lib/logsaber/simple_color.rb
Instance Attribute Summary collapse
-
#colors ⇒ Object
Returns the value of attribute colors.
Instance Method Summary collapse
Instance Attribute Details
#colors ⇒ Object
Returns the value of attribute colors.
3 4 5 |
# File 'lib/logsaber/simple_color.rb', line 3 def colors @colors end |
Instance Method Details
#color(index) ⇒ Object
9 10 11 |
# File 'lib/logsaber/simple_color.rb', line 9 def color index esc colors[index] end |
#colorize(index, text = nil, &block) ⇒ Object
5 6 7 |
# File 'lib/logsaber/simple_color.rb', line 5 def colorize index, text = nil, &block "#{color index}#{text || yield}#{esc 0}" end |
#esc(seq) ⇒ Object
17 18 19 |
# File 'lib/logsaber/simple_color.rb', line 17 def esc seq "\e[#{seq}m" end |