Module: Diffend::LocalContext::Host

Defined in:
lib/diffend/local_context/host.rb

Overview

Module responsible for building host information from local context

Class Method Summary collapse

Class Method Details

.callHash

Build host information

Returns:

  • (Hash)


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/diffend/local_context/host.rb', line 19

def call
  uname = Etc.uname

  {
    'command' => command,
    'name' => uname[:nodename],
    'system' => {
      'machine' => uname[:machine],
      'name' => uname[:sysname],
      'release' => uname[:release],
      'version' => uname[:version]
    },
    'tags' => tags,
    'user' => Etc.getpwuid(Process.uid)&.name || ENV['USERNAME'],
    'pid' => Process.pid
  }.freeze
end