I usually do something like this on my machine

loop do
 break if system("ping google.com")
 sleep 1
end
puts "Internet working!"

Cory Cory wrote:
> Does anyone know a way to test to see if the computer is connected to
> the internet in Ruby?
> 
> I wrote a Ruby program with WWW::Mechanize, but it completely hangs Ruby
> when my internet is turned off.  Because Ruby does not use system
> threading, there is no way to check for a timeout when WWW::Mechanizer
> freezes due to not having an internet connection.

-- 
Posted via http://www.ruby-forum.com/.