Skip to content
Browse files

Merge pull request #47 from ahmed80dz/master

colors in windows using win32console gem
  • Loading branch information...
2 parents e2c4cb6 + ad3b4f7 commit a53c815da0af5974cd5bcd8bb38bc3f66742715b Matt Darby committed
Showing with 10 additions and 2 deletions.
  1. +10 −2 koans/edgecase.rb
View
12 koans/edgecase.rb
@@ -2,7 +2,10 @@
# -*- ruby -*-
require 'test/unit/assertions'
-
+begin
+ require 'win32console'
+rescue LoadError
+end
# --------------------------------------------------------------------
# Support code for the Ruby Koans.
# --------------------------------------------------------------------
@@ -107,7 +110,9 @@ def color(color_value)
def use_colors?
return false if ENV['NO_COLOR']
if ENV['ANSI_COLOR'].nil?
- ! using_windows?
+ if using_windows?
+ using_win32console
+ end
else
ENV['ANSI_COLOR'] =~ /^(t|y)/i
end
@@ -116,6 +121,9 @@ def use_colors?
def using_windows?
File::ALT_SEPARATOR
end
+ def using_win32console
+ defined? Win32::Console
+ end
end
class Sensei

0 comments on commit a53c815

Please sign in to comment.
Something went wrong with that request. Please try again.