Class: Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/runit-man/utils.rb

Overview

Utilities.

Class Method Summary collapse

Class Method Details

.host_nameString

Note:

Caches host name on first access.

Gets local host name.

Returns:

  • (String)

    Host name.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/runit-man/utils.rb', line 10

def host_name
  unless @host_name
    begin
      @host_name = Socket.gethostbyname(Socket.gethostname).first
    rescue
      @host_name = Socket.gethostname
    end
  end

  @host_name
end

.t(*args) ⇒ String

I18n.t shortcut.

Returns:

  • (String)

    Translated string.



24
25
26
# File 'lib/runit-man/utils.rb', line 24

def t(*args)
  I18n.t(*args)
end