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.47 lib/base/internet.rb
dev-2.1.46 lib/base/internet.rb
dev-2.1.45 lib/base/internet.rb
dev-2.1.44 lib/base/internet.rb
dev-2.1.43 lib/base/internet.rb
dev-2.1.42 lib/base/internet.rb
dev-2.1.41 lib/base/internet.rb
dev-2.1.40 lib/base/internet.rb
dev-2.1.39 lib/base/internet.rb
dev-2.1.38 lib/base/internet.rb
dev-2.1.37 lib/base/internet.rb
dev-2.1.36 lib/base/internet.rb
dev-2.1.35 lib/base/internet.rb
dev-2.1.34 lib/base/internet.rb
dev-2.1.33 lib/base/internet.rb
dev-2.1.32 lib/base/internet.rb
dev-2.1.31 lib/base/internet.rb
dev-2.1.30 lib/base/internet.rb
dev-2.1.29 lib/base/internet.rb
dev-2.1.28 lib/base/internet.rb