2007-01-22 14:43:50 +01:00
|
|
|
module TestingSandbox
|
2007-02-09 09:04:31 +01:00
|
|
|
# Temporarily replaces KCODE for the block
|
|
|
|
def with_kcode(kcode)
|
2008-05-18 06:22:34 +02:00
|
|
|
if RUBY_VERSION < '1.9'
|
|
|
|
old_kcode, $KCODE = $KCODE, kcode
|
|
|
|
begin
|
|
|
|
yield
|
|
|
|
ensure
|
|
|
|
$KCODE = old_kcode
|
|
|
|
end
|
|
|
|
else
|
2007-02-09 09:04:31 +01:00
|
|
|
yield
|
2007-01-22 14:43:50 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|