mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-15 07:23:19 -04:00
Merge pull request #47 from ahmed80dz/master
colors in windows using win32console gem
This commit is contained in:
@@ -2,7 +2,10 @@
|
|||||||
# -*- ruby -*-
|
# -*- ruby -*-
|
||||||
|
|
||||||
require 'test/unit/assertions'
|
require 'test/unit/assertions'
|
||||||
|
begin
|
||||||
|
require 'win32console'
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
# Support code for the Ruby Koans.
|
# Support code for the Ruby Koans.
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
@@ -107,7 +110,9 @@ module EdgeCase
|
|||||||
def use_colors?
|
def use_colors?
|
||||||
return false if ENV['NO_COLOR']
|
return false if ENV['NO_COLOR']
|
||||||
if ENV['ANSI_COLOR'].nil?
|
if ENV['ANSI_COLOR'].nil?
|
||||||
! using_windows?
|
if using_windows?
|
||||||
|
using_win32console
|
||||||
|
end
|
||||||
else
|
else
|
||||||
ENV['ANSI_COLOR'] =~ /^(t|y)/i
|
ENV['ANSI_COLOR'] =~ /^(t|y)/i
|
||||||
end
|
end
|
||||||
@@ -116,6 +121,9 @@ module EdgeCase
|
|||||||
def using_windows?
|
def using_windows?
|
||||||
File::ALT_SEPARATOR
|
File::ALT_SEPARATOR
|
||||||
end
|
end
|
||||||
|
def using_win32console
|
||||||
|
defined? Win32::Console
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Sensei
|
class Sensei
|
||||||
|
|||||||
Reference in New Issue
Block a user