Last active
June 30, 2016 23:48
-
-
Save msroot/ea5e1f5a5b237e4552ac6bcb79606207 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # usage: $ ruby console.rb | |
| require 'irb' | |
| module IRB | |
| def self.start_session(binding) # call this method to drop into irb | |
| unless @__initialized | |
| args = ARGV | |
| ARGV.replace(ARGV.dup) | |
| IRB.setup(nil) | |
| ARGV.replace(args) | |
| @__initialized = true | |
| end | |
| workspace = WorkSpace.new(binding) | |
| irb = Irb.new(workspace) | |
| @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC] | |
| @CONF[:MAIN_CONTEXT] = irb.context | |
| catch(:IRB_EXIT) do | |
| irb.eval_input | |
| end | |
| end | |
| end | |
| IRB.start_session(binding) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment