Sha256: caf0a297c328cde46698cc7ae605728bf5facdb7bab184529d2265b1a8720052
Contents?: true
Size: 715 Bytes
Versions: 11
Compression:
Stored size: 715 Bytes
Contents
# Ruby 1.8 provides Ping.pingecho, but it was removed in 1.9. # So we try requiring it, and if that fails, define it ourselves. module VCR begin require 'ping' Ping = ::Ping rescue LoadError # This is copied, verbatim, from Ruby 1.8.7's ping.rb. require 'timeout' require "socket" module Ping def pingecho(host, timeout=5, service="echo") begin timeout(timeout) do s = TCPSocket.new(host, service) s.close end rescue Errno::ECONNREFUSED return true rescue Timeout::Error, StandardError return false end return true end module_function :pingecho end end end
Version data entries
11 entries across 11 versions & 1 rubygems