title: What is the correct way to detect if ruby is running on Windows?
body: <p>What is the correct way to detect from within Ruby whether the interpreter is running on Windows? "Correct" includes that it works on all major flavors of Ruby, including 1.8.x, 1.9.x, JRuby, Rubinius, and IronRuby.</p>
  
  <p>The currently top ranked Google results for "ruby detect windows" are all incorrect or outdated. For example, one incorrect way to do it is:</p>
  
  <pre><code>RUBY_PLATFORM =~ /mswin/
  </code></pre>
  
  <p>This is incorrect because it fails to detect the mingw version, or JRuby on Windows.</p>
  
  <p>What's the right way?</p>