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
I'd suggest trying this in ripl, an irb alternative. The above example works:
a = 'hello'
require 'ripl'
Ripl.start :binding => binding
Note that local variables work because your passing the current binding with the :binding option.
You could possibly do the same in irb, but since it's poorly documented and untested, your chances of doing it cleanly are slim to none.