Class: Resedit::Colorizer

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/resedit/classes/colorizer.rb

Constant Summary collapse

GRAY =
90
RED =
91
GREEN =
92
YELLOW =
93
BLUE =
94
PURPLE =
95
CYAN =
96
WHITE =
97

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeColorizer

Returns a new instance of Colorizer.



19
20
21
# File 'lib/resedit/classes/colorizer.rb', line 19

def initialize()
    @on = true
end

Instance Attribute Details

#onObject

Returns the value of attribute on.



15
16
17
# File 'lib/resedit/classes/colorizer.rb', line 15

def on
  @on
end

Instance Method Details

#blue(text) ⇒ Object



32
# File 'lib/resedit/classes/colorizer.rb', line 32

def blue(text) color(BLUE, text) end

#color(col, text) ⇒ Object



23
24
25
26
# File 'lib/resedit/classes/colorizer.rb', line 23

def color(col, text)
    return text if !@on
    return "\033[#{col}m#{text}\033[0m"
end

#cyan(text) ⇒ Object



34
# File 'lib/resedit/classes/colorizer.rb', line 34

def cyan(text) color(CYAN, text) end

#deep(text) ⇒ Object



33
# File 'lib/resedit/classes/colorizer.rb', line 33

def deep(text) color(PURPLE, text) end

#gray(text) ⇒ Object



28
# File 'lib/resedit/classes/colorizer.rb', line 28

def gray(text) color(GRAY, text) end

#green(text) ⇒ Object



30
# File 'lib/resedit/classes/colorizer.rb', line 30

def green(text) color(GREEN, text) end

#red(text) ⇒ Object



29
# File 'lib/resedit/classes/colorizer.rb', line 29

def red(text) color(RED, text) end

#white(text) ⇒ Object



35
# File 'lib/resedit/classes/colorizer.rb', line 35

def white(text) color(WHITE, text) end

#yellow(text) ⇒ Object



31
# File 'lib/resedit/classes/colorizer.rb', line 31

def yellow(text) color(YELLOW, text) end