1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
module TestingSandbox # Temporarily replaces KCODE for the block def with_kcode(kcode) if RUBY_VERSION < '1.9' old_kcode, $KCODE = $KCODE, kcode begin yield ensure $KCODE = old_kcode end else yield end end end