I\'ve been just going through PragProg Continuous Testing With Ruby, where they talk about invoking IRB in context of current class to inspect the code
IRB
Instead of global you could use instance variables, e.g.:
require 'irb' @a = "hello" ARGV.clear IRB.start >> @a => "hello"