Class: Coppertone::Utils::HostUtils

Inherits:
Object
  • Object
show all
Defined in:
lib/coppertone/utils/host_utils.rb

Overview

A utility class that includes methods for working with data about the host.

Class Method Summary collapse

Class Method Details

.clear_hostnameObject



17
18
19
# File 'lib/coppertone/utils/host_utils.rb', line 17

def self.clear_hostname
  @hostname = nil
end

.hostnameObject



8
9
10
11
12
13
14
15
# File 'lib/coppertone/utils/host_utils.rb', line 8

def self.hostname
  @hostname ||=
    begin
      Socket.gethostbyname(Socket.gethostname).first
    rescue SocketError
      Socket.gethostname
    end
end