假设我有一个像这样的哈希:
foo = {
:bar => ['r', 'baz'], # has a total str length of 4 characters inside of the array
:baz => ['words', 'etc', 'long words'] # has a total str length of 18 characters inside of the array,
:blah => ['at'] # has a total str length of 2 characters inside of the array
# etc...
}
我将如何按数组中包含的项目的总字符串长度对该哈希进行排序?在这种情况下,生成的哈希顺序应该是::blah, :bar, :baz