Method: Bombshell::Shell::ClassMethods#launch

Defined in:
lib/bombshell/shell.rb

#launch(*arguments) ⇒ Object

Launch the shell.

You should generally call Bombshell.launch(MyShell) instead of MyShell.launch directly, as the former approach will handle exits correctly and pass command-line parameters as arguments.

Parameters:

  • arguments (Array)

    An array of arguments that, eventually, callbacks might use. If you’re using the Bombshell.launch wrapper, these will be command-line parameters.



54
55
56
57
58
59
60
61
62
63
# File 'lib/bombshell/shell.rb', line 54

def launch(*arguments)
  @bombshell_callbacks[:before_launch].each do |callback|
    callback.call(*arguments.first(callback.arity > -1 ? callback.arity : 0))
  end
  shell = new(*arguments)
  @bombshell_callbacks[:having_launched].each do |callback|
    shell.instance_eval &callback
  end
  ::IRB.start_session(shell.get_binding)
end