我正在寻找转换以下数据结构
series = [{:name => "foo", :data => [12, 23]},
{:name => "bar", :data => [14, 22]},
{:name => "foo", :data => [15, 26]}]
到
series = [{:name => "foo", :data => [[12, 23],[15,26]]},
{:name => "bar", :data => [14, 22]}]
在 ruby 1.8 中解决这个问题的最佳方法应该是什么?