Module: Specjour::SocketHelper

Included in:
Dispatcher, Manager, RsyncDaemon, Worker
Defined in:
lib/specjour/socket_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) current_uri



15
16
17
# File 'lib/specjour/socket_helper.rb', line 15

def current_uri
  @current_uri ||= new_uri
end

- (Object) hostname



11
12
13
# File 'lib/specjour/socket_helper.rb', line 11

def hostname
  @hostname ||= Socket.gethostname
end

- (Object) ip_from_hostname(hostname)



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

- (Object) new_uri



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