IMO there is no simple way to find it out.
I would first test the PLATFORM constant.
If it is some kind of UNIX you can use
uname
or the uname module from
http://www.ruby-lang.org/raa/list.rhtml?> name=sys-unameFor
Windows I don’t know.
try “ver”