Use Hash#each_key instead of Hash#keys.each

Hash#keys.each allocates an array of keys.

Hash#each_key iterates through the keys without allocating a
new array and as such is a better, more specific tool for the
job.
Derive ASC_DESC constant from ASC and DESC ones.

Note that when most users have upgraded to Ruby 2.2 and up, it seems
the best strategy might be to use string#freeze instead, which may be
faster than looking up constants.