且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我怎样才能将这个哈希数组分组?

更新时间:2022-10-15 16:29:06

The &:age means that the group_by method should call the age method on the items to get the group by data. This age method is not defined on the items which are Hashes.

This should work:

array.group_by { |d| d[:age] }

相关阅读

技术问答最新文章