Skip to content

Instantly share code, notes, and snippets.

@josephsiefers
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephsiefers/9935000 to your computer and use it in GitHub Desktop.
Save josephsiefers/9935000 to your computer and use it in GitHub Desktop.
Conor Hunt's IRB debugger script
if Rails.env.development? || Rails.env.test?
require 'irb'
module IRB
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
else
module IRB # :nodoc:
def self.start_session(binding)
puts "Attemting to start IRB session in prod"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment