mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-20 07:56:09 +01:00
16 lines
274 B
Ruby
16 lines
274 B
Ruby
|
|
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
|