Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (26 sloc) 0.624 kB
module Specjour
module SocketHelper
Socket.do_not_reverse_lookup = true
def ip_from_hostname(hostname)
Socket.getaddrinfo(hostname, nil, Socket::AF_INET, Socket::SOCK_STREAM).first.fetch(3)
rescue SocketError
hostname
end
def hostname
@hostname ||= Socket.gethostname
end
def current_uri
@current_uri ||= new_uri
end
def new_uri
URI::Generic.build :host => faux_server[2], :port => faux_server[1]
end
protected
def faux_server
server = TCPServer.new('0.0.0.0', nil)
server.addr
ensure
server.close
end
end
end
Jump to Line
Something went wrong with that request. Please try again.