b=[[6, "Jet"], [0, "Fuel"], [0, "Engine"]] c = Hash.new { |h, k| h[k] = [] }b.each { |k, v| c[k] << v } p c
Standard input is empty
{6=>["Jet"], 0=>["Fuel", "Engine"]}
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!