Module: TTY::Exit::Registry

Defined in:
lib/tty/exit/registry.rb

Class Method Summary collapse

Class Method Details

.exitsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A storage for custom exit codes



9
10
11
# File 'lib/tty/exit/registry.rb', line 9

def self.exits
  @exits ||= {}
end

.register_exit(name, code, message) ⇒ Object

Register a custom exit code

Parameters:

  • name (String)
  • code (Integer)
  • message (String)


20
21
22
23
# File 'lib/tty/exit/registry.rb', line 20

def self.register_exit(name, code, message)
  exits[name] = {code: code, message: message}
  exits[code] = {code: code, message: message}
end