Object#methods returns an array of symbols on 1.9+

Fixes #31926.