How do I sort an array of hashes by a value in the hash?

后端 未结 4 1203
旧巷少年郎
旧巷少年郎 2020-12-07 11:05

This Ruby code is not behaving as I would expect:

# create an array of hashes
sort_me = []
sort_me.push({\"value\"=>1, \"name\"=>\"a\"})
sort_me.push({         


        
4条回答
提交回复
热议问题