Created
May 3, 2012 08:32
-
-
Save stereosupersonic/2584387 to your computer and use it in GitHub Desktop.
check internet connenction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#from here: http://stackoverflow.com/questions/2385186/check-if-internet-connection-exists-with-ruby | |
require 'open-uri' | |
def internet_connection? | |
begin | |
true if open("http://www.google.com/") | |
rescue | |
false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment