[Ruby] hash key order

ben wiseley wiseleyb at gmail.com
Fri Feb 23 10:40:40 PST 2007


Can you depend on the order of keys in a hash in Ruby?

Example:
h = {:one => "one", :two => "two"}

Will h.keys.first always be :one or can't you depend on that?

-ben


More information about the Ruby mailing list