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.67 lib/base/internet.rb
dev-2.1.66 lib/base/internet.rb
dev-2.1.65 lib/base/internet.rb
dev-2.1.64 lib/base/internet.rb
dev-2.1.63 lib/base/internet.rb
dev-2.1.62 lib/base/internet.rb
dev-2.1.61 lib/base/internet.rb
dev-2.1.60 lib/base/internet.rb
dev-2.1.59 lib/base/internet.rb
dev-2.1.58 lib/base/internet.rb
dev-2.1.57 lib/base/internet.rb
dev-2.1.56 lib/base/internet.rb
dev-2.1.55 lib/base/internet.rb
dev-2.1.54 lib/base/internet.rb
dev-2.1.53 lib/base/internet.rb
dev-2.1.52 lib/base/internet.rb
dev-2.1.51 lib/base/internet.rb
dev-2.1.50 lib/base/internet.rb
dev-2.1.49 lib/base/internet.rb
dev-2.1.48 lib/base/internet.rb