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.132 lib/base/internet.rb
dev-2.1.131 lib/base/internet.rb
dev-2.1.130 lib/base/internet.rb
dev-2.1.129 lib/base/internet.rb
dev-2.1.128 lib/base/internet.rb
dev-2.1.127 lib/base/internet.rb
dev-2.1.126 lib/base/internet.rb
dev-2.1.125 lib/base/internet.rb
dev-2.1.124 lib/base/internet.rb
dev-2.1.123 lib/base/internet.rb
dev-2.1.122 lib/base/internet.rb
dev-2.1.121 lib/base/internet.rb
dev-2.1.120 lib/base/internet.rb
dev-2.1.119 lib/base/internet.rb
dev-2.1.118 lib/base/internet.rb
dev-2.1.117 lib/base/internet.rb
dev-2.1.116 lib/base/internet.rb
dev-2.1.115 lib/base/internet.rb
dev-2.1.114 lib/base/internet.rb
dev-2.1.113 lib/base/internet.rb