我已經散列的數組稱爲@messages:如何計算Ruby中哈希數組屬性的不同值?
[{ "id" => "1", "user_name" => "John", "content" => "xxxxx" },
{ "id" => "2", "user_name" => "John", "content" => "yyyyy" },
{ "id" => "3", "user_name" => "Paul", "content" => "zzzzzz" },
{ "id" => "4", "user_name" => "George", "content" => "xxyyzz" }]
什麼是計算user_name
在@messages(應該在這裏給3)不同值的方法?
偉大工程的感謝! – PEF