class Object

Public Instance Methods

execute() click to toggle source
# File bin/wait-for-socket, line 12
def execute
  puts "Waiting for #{description} to become available at #{address}:#{port_int}"
  loop do
    if socket_reachable?(address, port_int)
      puts
      puts "#{description} ready"
      break
    else
      $stderr.write "."
      sleep 2
    end
  end
end
port_int() click to toggle source
# File bin/wait-for-socket, line 28
def port_int
  port.to_i
end
socket_reachable?(hostname, port) click to toggle source
# File bin/wait-for-socket, line 32
def socket_reachable?(hostname, port)
  Socket.tcp(hostname, port, connect_timeout: 2) {}
  true
rescue StandardError => e
  false
end