Class: Socket

Inherits:
Object
  • Object
show all
Defined in:
lib/mobilize-ssh/extensions/socket.rb

Class Method Summary collapse

Class Method Details

.domain_nameObject



10
11
12
# File 'lib/mobilize-ssh/extensions/socket.rb', line 10

def Socket.domain_name
  Socket.official_hostname.split(".")[-2..-1].join(".")
end

.official_hostnameObject



2
3
4
5
6
7
8
# File 'lib/mobilize-ssh/extensions/socket.rb', line 2

def Socket.official_hostname
  begin
    Socket.gethostbyname(Socket.gethostname).first
  rescue
    Socket.gethostname
  end
end