Module: CommandKit::ProgramName::ClassMethods

Defined in:
lib/command_kit/program_name.rb

Overview

Class-level methods.

Constant Summary collapse

IGNORED_PROGRAM_NAMES =

List of $PROGRAM_NAMEs that should be ignored.

[
  '-e',   # ruby -e "..."
  'irb',  # running in irb
  'rspec' # running in rspec
]

Instance Method Summary collapse

Instance Method Details

#program_nameString?

The current program name ($PROGRAM_NAME).

Returns:

  • (String, nil)

    The $PROGRAM_NAME or nil if the $PROGRAM_NAME is -e, irb, or rspec.



52
53
54
# File 'lib/command_kit/program_name.rb', line 52

def program_name
  $PROGRAM_NAME unless IGNORED_PROGRAM_NAMES.include?($PROGRAM_NAME)
end