Module: Specjour::SocketHelper
- Included in:
- Dispatcher, Manager, RsyncDaemon, Worker
- Defined in:
- lib/specjour/socket_helper.rb
Instance Method Summary collapse
Instance Method Details
#current_uri ⇒ Object
15 16 17 |
# File 'lib/specjour/socket_helper.rb', line 15 def current_uri @current_uri ||= new_uri end |
#hostname ⇒ Object
11 12 13 |
# File 'lib/specjour/socket_helper.rb', line 11 def hostname @hostname ||= Socket.gethostname end |
#ip_from_hostname(hostname) ⇒ Object
5 6 7 8 9 |
# File 'lib/specjour/socket_helper.rb', line 5 def ip_from_hostname(hostname) Socket.getaddrinfo(hostname, nil, Socket::AF_INET, Socket::SOCK_STREAM).first.fetch(3) rescue SocketError hostname end |
#new_uri ⇒ Object
19 20 21 |
# File 'lib/specjour/socket_helper.rb', line 19 def new_uri URI::Generic.build :host => faux_server[2], :port => faux_server[1] end |