Afaik there are good values stored in RbConfig as well. I remember that the swt gem did quite some magic mish mash there... a few approaches are mentioned [here](http://stackoverflow.com/questions/11784109/detecting-operating-systems-in-ruby) - unfortuantely the module does not seem to be documented (e.g. RbConfig itself).

And [here](https://github.com/danlucraft/swt/blob/master/lib/swt/jar_loader.rb#L12) you can see what we do in the swt gem.