Sha256: 77bacf8311b2ae5514677bde07394930dd485f6e1a1503e32d4f0cf39847a160

Contents?: true

Size: 525 Bytes

Versions: 251

Compression:

Stored size: 525 Bytes

Contents

puts __FILE__ if defined?(DEBUG)

require 'open-uri'
require 'timeout'
class Internet

	@@available=true

	def self.available?
		return @@available if !@@available.nil?

		begin
			index=open('http://www.google.com').read 
			if index.include?('<Title>Google')
				@@available = true
			else
				puts "open('http://www.google.com') returned false"
			end
		rescue Exception => e
			puts "open('http://www.google.com') raised an exception: #{e.to_s}"
			@@available = false
		end
		@@available
	end
end

Version data entries

251 entries across 251 versions & 1 rubygems

Version Path
dev-2.1.112 lib/base/internet.rb
dev-2.1.111 lib/base/internet.rb
dev-2.1.110 lib/base/internet.rb
dev-2.1.109 lib/base/internet.rb
dev-2.1.108 lib/base/internet.rb
dev-2.1.107 lib/base/internet.rb
dev-2.1.106 lib/base/internet.rb
dev-2.1.105 lib/base/internet.rb
dev-2.1.104 lib/base/internet.rb
dev-2.1.103 lib/base/internet.rb
dev-2.1.102 lib/base/internet.rb
dev-2.1.101 lib/base/internet.rb
dev-2.1.100 lib/base/internet.rb
dev-2.1.99 lib/base/internet.rb
dev-2.1.98 lib/base/internet.rb
dev-2.1.97 lib/base/internet.rb
dev-2.1.96 lib/base/internet.rb
dev-2.1.95 lib/base/internet.rb
dev-2.1.94 lib/base/internet.rb
dev-2.1.93 lib/base/internet.rb