Created
March 11, 2010 08:02
-
-
Save apeiros/328951 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Kernel | |
def irb_drop(context=nil, *argv) | |
require 'irb' | |
require 'pp' | |
require 'yaml' | |
original_argv = ARGV.dup | |
ARGV.replace(argv) # IRB is being stupid | |
IRB.setup(nil) # FIXME: must only be called once | |
irb = IRB::Irb.new(IRB::WorkSpace.new(context)) | |
IRB.conf[:IRB_RC].call(irb.context) if IRB.conf[:IRB_RC] # loads the irbrc? | |
IRB.conf[:MAIN_CONTEXT] = irb.context # why would the main context be set here? | |
trap("SIGINT") do irb.signal_handle end | |
ARGV.replace(original_argv) | |
catch(:IRB_EXIT) do irb.eval_input end | |
end | |
module_function :irb_drop | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment