Skip to content

Instantly share code, notes, and snippets.

@akshaykarle
Created October 17, 2013 07:14
Show Gist options
  • Save akshaykarle/7020416 to your computer and use it in GitHub Desktop.
Save akshaykarle/7020416 to your computer and use it in GitHub Desktop.
require 'irb'
module IRB # :nodoc:
def self.start_session(binding)
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
@akshaykarle
Copy link
Author

IRB.start_session(binding|get_binding)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment