mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-15 07:23:19 -04:00
Disabled colored output on windows.
This commit is contained in:
@@ -93,16 +93,29 @@ module EdgeCase
|
||||
end
|
||||
|
||||
def colorize(string, color_value)
|
||||
if ENV['NO_COLOR']
|
||||
string
|
||||
else
|
||||
if use_colors?
|
||||
color(color_value) + string + color(COLORS[:clear])
|
||||
else
|
||||
string
|
||||
end
|
||||
end
|
||||
|
||||
def color(color_value)
|
||||
"\e[#{color_value}m"
|
||||
end
|
||||
|
||||
def use_colors?
|
||||
return false if ENV['NO_COLOR']
|
||||
if ENV['ANSI_COLOR'].nil?
|
||||
! using_windows?
|
||||
else
|
||||
ENV['ANSI_COLOR'] =~ /^(t|y)/i
|
||||
end
|
||||
end
|
||||
|
||||
def using_windows?
|
||||
File::ALT_SEPARATOR
|
||||
end
|
||||
end
|
||||
|
||||
class Sensei
|
||||
|
||||
@@ -93,16 +93,29 @@ module EdgeCase
|
||||
end
|
||||
|
||||
def colorize(string, color_value)
|
||||
if ENV['NO_COLOR']
|
||||
string
|
||||
else
|
||||
if use_colors?
|
||||
color(color_value) + string + color(COLORS[:clear])
|
||||
else
|
||||
string
|
||||
end
|
||||
end
|
||||
|
||||
def color(color_value)
|
||||
"\e[#{color_value}m"
|
||||
end
|
||||
|
||||
def use_colors?
|
||||
return false if ENV['NO_COLOR']
|
||||
if ENV['ANSI_COLOR'].nil?
|
||||
! using_windows?
|
||||
else
|
||||
ENV['ANSI_COLOR'] =~ /^(t|y)/i
|
||||
end
|
||||
end
|
||||
|
||||
def using_windows?
|
||||
File::ALT_SEPARATOR
|
||||
end
|
||||
end
|
||||
|
||||
class Sensei
|
||||
|
||||
Reference in New Issue
Block a user