Sha256: c15c1762c9df72f89136c3ce95e3cf3b3239cccfac5206cb8dd6d8ac0b3cf4cc
Contents?: true
Size: 485 Bytes
Versions: 7
Compression:
Stored size: 485 Bytes
Contents
module LitmusPaper module Dependency class TCP def initialize(ip, port, options = {}) @ip, @port = ip, port @timeout = options.fetch(:timeout_seconds, 5) end def available? Timeout.timeout(@timeout) do socket = TCPSocket.new(@ip, @port) socket.close end true rescue Exception false end def to_s "Dependency::TCP(tcp://#{@ip}:#{@port})" end end end end
Version data entries
7 entries across 7 versions & 1 rubygems