Sha256: 6fe38e4a8fc04b3db42c4b5f5c135eced9129899a45301957dfaa7d62b9c8535

Contents?: true

Size: 284 Bytes

Versions: 1

Compression:

Stored size: 284 Bytes

Contents

module Kamerling
  Addr = Struct.new :host, :port, :prot do
    def connectable?
      TCPSocket.open(*self).close
      true
    rescue Errno::ECONNREFUSED
      false
    end

    def to_a
      [host, port]
    end

    def to_s
      "#{host}:#{port} (#{prot})"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kamerling-0.0.1 lib/kamerling/addr.rb