module Bombshell
Bombshell
enables the lickety-split creation of interactive consoles (really just boring old custom IRB
sessions). As a Ruby library developer, you may want to build a little shell into your library so that other developers can play around with it before adding it to their applications. In the past this has been a real PITA. With Bombshell
it’s a little easier.
Constants
- VERSION
Used by Bueller
Public Class Methods
Launch a shell. This is typically called from a “gem binary” executable Ruby script as described in the README. @param [Class] shell The shell class to launch. Must include Bombshell::Shell
.
# File lib/bombshell.rb, line 17 def launch(shell) begin failure = shell.launch(ARGV.dup) Kernel.exit(failure ? 1 : 0) rescue SystemExit => e Kernel.exit(e.status) rescue Exception => e STDERR.puts("#{e.message} (#{e.class})") STDERR.puts(e.backtrace.join("\n")) Kernel.exit(1) end end
Private Instance Methods
Launch a shell. This is typically called from a “gem binary” executable Ruby script as described in the README. @param [Class] shell The shell class to launch. Must include Bombshell::Shell
.
# File lib/bombshell.rb, line 17 def launch(shell) begin failure = shell.launch(ARGV.dup) Kernel.exit(failure ? 1 : 0) rescue SystemExit => e Kernel.exit(e.status) rescue Exception => e STDERR.puts("#{e.message} (#{e.class})") STDERR.puts(e.backtrace.join("\n")) Kernel.exit(1) end end