Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我的哈希:
h_letters = { first: { value: 2, text: "H" }, second: { value: 2, text: "HH" }, third: { value: 4, text: "HHH" } }
我想获得整个哈希值的最大值的文本。
谢谢你的帮助
h_letters.max_by { |h| h.last[:value] }.last[:text] #=> "HHH"