Module: Sys::Proc::Concern::System::Generic

Defined in:
lib/sys/proc/concern/system/generic.rb

Overview

Provides generic methods

This generic module can be used through the system/generic helper in other system(s) specific modules. This is the default (included) module when specific module is missing.

Instance Method Summary collapse

Instance Method Details

#default_prognameString

Get default program name

Returns:

  • (String)


38
39
40
41
42
# File 'lib/sys/proc/concern/system/generic.rb', line 38

def default_progname
  file = caller.last.split(/:[0-9]+:in\s/).fetch(0)

  File.basename(file, '.rb')
end

#prognameString

Get program name

Returns:

  • (String)


31
32
33
# File 'lib/sys/proc/concern/system/generic.rb', line 31

def progname
  $PROGRAM_NAME
end

#progname=(progname) ⇒ String

Set program name

When progname is nil will use a default progname

Parameters:

  • progname (String)

Returns:

  • (String)


23
24
25
26
# File 'lib/sys/proc/concern/system/generic.rb', line 23

def progname=(progname)
  progname ||= default_progname
  $PROGRAM_NAME = progname.to_s
end