I've got some ruby code that I'm converting to Ruby 1.9. One warning I get is Hash#index is deprecated; use Hash#key
But Hash#key is not defined in Ruby 1.8, so I can't use that directly. Does anybody have a good alternative?
I've got a couple of options (which I'll post as answers so you can vote), but I'm hoping for better.