From: Jeremy Henty Date: 2009-03-24T21:21:54+09:00 Subject: [Q&A]: HOWTO start irb on a different object I wanted to have irb start its session on an object other than the toplevel. I found a solution that I think is nicer than any I could find elsewhere. The idea is to hook into IRB::Irb#initialize and insert the WorkSpace object that you want. require "irb" class IRB::Irb alias initialize_orig initialize def initialize(workspace = nil, *args) default = IRB.conf[:DEFAULT_OBJECT] workspace ||= IRB::WorkSpace.new default if default initialize_orig(workspace, *args) end end Now, if your .irbrc sets IRB.conf[:DEFAULT_OBJECT], that becomes the initial object for the irb session. I am tempted to propose this as a change to irb. Thoughts? Regards, Jeremy Henty