From: ahmed80dz Date: Tue, 23 Aug 2011 00:24:10 +0000 (+0200) Subject: using windows32console gem for colors X-Git-Url: https://git.eng.unimelb.edu.au/public?p=ruby_koans.git;a=commitdiff_plain;h=6fd8668b7029b34b6c6354b58e217ede44bc415e using windows32console gem for colors --- diff --git a/koans/edgecase.rb b/koans/edgecase.rb index ba49956..8d9646b 100644 --- a/koans/edgecase.rb +++ b/koans/edgecase.rb @@ -107,7 +107,9 @@ module EdgeCase 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 +118,13 @@ module EdgeCase def using_windows? File::ALT_SEPARATOR end + def using_win32console + begin + !! Win32::Console::ANSI + rescue + return false + end + end end class Sensei