Class: Socket

Inherits:
Object
  • Object
show all
Defined in:
lib/liquid/ext/socket.rb

Class Method Summary collapse

Class Method Details

.fqdnObject



7
8
9
# File 'lib/liquid/ext/socket.rb', line 7

def self.fqdn
  Socket.gethostbyaddr(IPAddr.new(ipaddress).hton)[0]
end

.ipaddressObject



2
3
4
5
# File 'lib/liquid/ext/socket.rb', line 2

def self.ipaddress
  hostname = %x(hostname).chomp
  getaddrinfo(hostname, nil).first[3]
end