mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-21 01:03:20 -04:00
Disable colorization when the NO_COLOR env variable is defined.
This commit is contained in:
@@ -53,8 +53,12 @@ module EdgeCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.colorize(string, color_value)
|
def self.colorize(string, color_value)
|
||||||
|
if ENV['NO_COLOR']
|
||||||
|
string
|
||||||
|
else
|
||||||
color(color_value) + string + color(COLORS[:clear])
|
color(color_value) + string + color(COLORS[:clear])
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.color(color_value)
|
def self.color(color_value)
|
||||||
"\e[#{color_value}m"
|
"\e[#{color_value}m"
|
||||||
|
|||||||
Reference in New Issue
Block a user