我有一个哈希如下:
hash = {"Monday" => "a", "Tuesday" => "b", "Wednesday" => "c", "Thursday" => "b", "Friday" => "c"}
我想得到一个新的哈希,它将是:
{"a" => "Monday", "b" => "Tuesday, Thursday" , "c" => "Wednesday, Friday"}
Hash#invert
只给出第一个值并丢失重复的值。有什么有效的方法来做到这一点?