Sha256: 76f1efd2b93259da3379bf28869d2fe9188b436a5e0fba9c845a48c61e2da7aa

Contents?: true

Size: 410 Bytes

Versions: 5

Compression:

Stored size: 410 Bytes

Contents

module LitmusPaper
  module Dependency
    class TCP
      def initialize(ip, port)
        @ip, @port = ip, port
      end

      def available?
        Timeout.timeout(5) 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

5 entries across 5 versions & 1 rubygems

Version Path
litmus_paper-0.3.2 lib/litmus_paper/dependency/tcp.rb
litmus_paper-0.3.1 lib/litmus_paper/dependency/tcp.rb
litmus_paper-0.3.0 lib/litmus_paper/dependency/tcp.rb
litmus_paper-0.1.0 lib/litmus_paper/dependency/tcp.rb
litmus_paper-0.0.3 lib/litmus_paper/dependency/tcp.rb