Sha256: 959429e8bacf618a31c10819472229168b49178aa0f1e995fea2b9de01d93380

Contents?: true

Size: 338 Bytes

Versions: 2

Compression:

Stored size: 338 Bytes

Contents

require 'curb'

module RankMirror
	class Reachable
		def initialize(uri,timeout)
			@uri = uri
			@timeout = timeout
		end

		def reachable?
			begin
				r = Curl::Easy.new(@uri)
				r.timeout_ms = @timeout
				r.perform
				if r.response_code == 404
					false
				else
					true
				end
			rescue
				return false
			end
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rankmirror-1.1.0 lib/rankmirror/reachable.rb
rankmirror-1.0.0 lib/rankmirror/reachable.rb