Class: TeutonGet::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/teuton-get/writer/format.rb

Constant Summary collapse

COLORS =
[:light_blue, :light_magenta, :light_cyan, :red, :green, :yellow]

Class Method Summary collapse

Class Method Details

.colorize(text = "", option = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/teuton-get/writer/format.rb', line 11

def self.colorize(text = "", option = nil)
  return text if option.nil?
  color = if option.instance_of? Integer
    if option < COLORS.size
      COLORS[option]
    else
      COLORS[option - COLOR.size]
    end
  elsif option.instance_of? Symbol
    option
  else
    :silver
  end
  text.colorize(color)
end

.disableObject



7
8
9
# File 'lib/teuton-get/writer/format.rb', line 7

def self.disable
  String.disable_colorization = true
end