Actually, you can, but you have to explicitly choose. I don't recall off
the top of my head, as I haven't looked in quite a while, but I believe
that Gentoo installs /usr/bin/ruby18 and /usr/bin/ruby19 (as well as
gem18 and gem19), and just toggles the /usr/bin/ruby symlink.
That's great, until your script wants to run some other script. Maybe the
"right way" would be to require it somehow, but maybe I just want my script to
do something like "system rake" or "system gem". Or maybe I've split my
program into several processes, but rather than actually forking, they're
distinct scripts.
The point is, in any of these scenarios, the Gentoo way could switch the ruby
interpreter out from under me.
So, while it's nice to be able to toggle the symlink, that's only a partial
solution. For a real solution, you'd want something like:
/usr/lib/ruby/1.8/bin/
/usr/lib/ruby/1.9.1/bin/
Toggle those in your paths, and have a just plain "ruby", "gem", "rake", etc
-- even install gem binaries in there (or wherever it ends up being).
Aside from that, it has the nice property of the switch being atomic --
there's no race condition where you might be running gem18 with the ruby19
interpreter (assuming gem18 has #!/usr/bin/ruby, but as above, you still want
to be confident that the "ruby" binary is the same ruby that you're running.)