I’ve just finished updating all of the libraries I use to run this site to work under Ruby 2, and it’s been a fairly smooth ride.
A few gotchas that happened more than once:
- It’s strict about the encoding of the return value of
#inspect. Volating this constraint looks like:
Encoding::CompatibilityError: inspected result must be ASCII only or use the same encoding with default external. Mostly I solved this by just not inspecting, but I guess you could do it by transcoding the return value in your custom
- The thread primitives refuse to work inside of a signal-handler. I saw this first in Foreman, which I use to launch mongrel2 and a bunch of Strelka apps in development. This can only be a good thing, as signal handlers should be re-entrant. I submitted a patch to Foreman that adds deferred signal-handling via a Thread-local queue (on the main thread) and DJB’s self-pipe trick. This also cleared up a problem I was having with recent Foreman releases which would make the foreman process not respond to signals at all. Perhaps it was related?
- The new regex engine still has a few kinks.
Ruby 2 is noticably faster than 1.9.3, as well. All in all, it’s been a fantastic p0 release.