Open the default browser in Ruby
Cross-platform solution:
First, install the Launchy gem:
$ gem install launchy
Then, you can run this:
require 'launchy'
Launchy.open("http://stackoverflow.com")
This should work on most platforms:
link = "Insert desired link location here"
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
system "start #{link}"
elsif RbConfig::CONFIG['host_os'] =~ /darwin/
system "open #{link}"
elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
system "xdg-open #{link}"
end
Mac-only solution:
system("open", "http://stackoverflow.com/")
or
`open http://stackoverflow.com/`