Class: Colors

Inherits:
Object
  • Object
show all
Defined in:
lib/colors.rb

Constant Summary collapse

COLORS =
{ red: 31, green: 32, yellow: 33, blue: 34, purple: 35, cyan: 36, white: 0 }

Class Method Summary collapse

Class Method Details

.code(num) ⇒ Object



17
18
19
# File 'lib/colors.rb', line 17

def code(num)
  "\e[#{num}m"
end

.color(num, string) ⇒ Object



13
14
15
# File 'lib/colors.rb', line 13

def color(num, string)
  @enabled ? "#{code(num)}#{string}#{code(0)}" : string
end

.enabled=(value) ⇒ Object



9
10
11
# File 'lib/colors.rb', line 9

def enabled=(value)
  @enabled = value
end

.enabled?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/colors.rb', line 5

def enabled?
  @enabled
end