puts RUBY_PLATFORM
To return one of Windows, Mac, Linux you could do:
if (RUBY_PLATFORM.include? ("darwin"))
os = "Mac"
elsif (RUBY_PLATFORM.include? ("nix"))
os = "Linux"
elsif (RUBY_PLATFORM.include? ("Win"))
os = "Windows"
else
os = ""
end
there is also
puts ENV['OS']
but this only works on windows and is empty for Linux and Mac OS X
No comments:
Post a Comment