我有一个看起来像这样的哈希
h1 = {"4c09a0da6071a593f051de32"=>["4c09a0da6071a593f051de32", "Cafe Bistro", 37.78458803130115, -122.40743637084961, 215.0], "4abbb03ef964a520668420e3"=>["4abbb03ef964a520668420e3", "The Plant Cafe Organic", 37.7977805076241, -122.3957633972168, 83.0] }
我想按每个哈希中的最终值对其进行排序,例如 83.0、215.0
我试过了
h1 = h1.sort_by{|k,v| v[4]}
但是在输出中放入一个数组而不是哈希,我想保持哈希相同,只是重新排序......我该怎么做?