Class: Enhanced::Colors

Inherits:
Object
  • Object
show all
Defined in:
lib/enhanced/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



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

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

.color(num, string) ⇒ Object



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

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

.enabled=(value) ⇒ Object



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

def enabled=(value)
  @enabled = value
end

.enabled?Boolean

Returns:

  • (Boolean)


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

def enabled?
  @enabled
end