I am using colored
gem for coloured printing in the terminal and ruby logger. I need to run this code on linux and on windows.
On windows, I must first require 'win32console'
or else coloured printing doesn't work (I just see ANSI escape characters instead). But if I require win32console on linux it breaks, obviously.
What's the usual way to handle a situation like this in ruby? I noticed the RUBY_PLATFORM
variable, but on a windows VM I tried it was "i386-mingw32"
or something strange. Using that plus a conditional seems like a pretty flakey way to go about what I need, so I was hoping this problem has a better solution.