Class: Hscode::PrettyPrint
- Inherits:
-
Object
- Object
- Hscode::PrettyPrint
- Defined in:
- lib/hscode/pretty_print.rb
Constant Summary collapse
- COLORS =
{ '0' => 255, '1' => 6, '2' => 2, '3' => 3, '4' => 9, '5' => 1 }.freeze
Class Method Summary collapse
Class Method Details
.make_pretty(text, color_code) ⇒ Object
18 19 20 |
# File 'lib/hscode/pretty_print.rb', line 18 def self.make_pretty(text, color_code) "\x1b[38;5;#{color_code}m#{text}\n" end |
.print(text, colour_code) ⇒ Object
12 13 14 |
# File 'lib/hscode/pretty_print.rb', line 12 def self.print(text, colour_code) puts make_pretty(text, COLORS[colour_code]) end |