root/trunk/actionpack/test/testing_sandbox.rb
| Revision 8464, 274 bytes (checked in by bitsweat, 10 months ago) |
|---|
| Line | |
|---|---|
| 1 | module TestingSandbox |
| 2 | # Temporarily replaces KCODE for the block |
| 3 | def with_kcode(kcode) |
| 4 | if RUBY_VERSION < '1.9' |
| 5 | old_kcode, $KCODE = $KCODE, kcode |
| 6 | begin |
| 7 | yield |
| 8 | ensure |
| 9 | $KCODE = old_kcode |
| 10 | end |
| 11 | else |
| 12 | yield |
| 13 | end |
| 14 | end |
| 15 | end |
Note: See TracBrowser for help on using the browser.