Module: TyrantManager::Util

Included in:
TyrantManager
Defined in:
lib/tyrant_manager/util.rb

Instance Method Summary collapse

Instance Method Details

#ip_of(hostname) ⇒ Object



8
9
10
11
12
# File 'lib/tyrant_manager/util.rb', line 8

def ip_of( hostname )
  hostname = Socket.gethostname if %w[ localhost 0.0.0.0 ].include?( hostname )
  addr_info = Socket.getaddrinfo( hostname, 1978, "AF_INET" )
  return addr_info.first[3]
end