How to modify arrays of hash? : I have a `array_of_hash` 

    array_of_hash = [
     {:name=>"1", :address=>"USA", :collection=>["LAND", "WATER", "OIL", "TREE", "SAND"], :sequence=>"AB"},
     {:name=>"5", :address=>"UK", :collection=>["LAND", "WATER", "OIL", "TREE", "SAND"], :sequence=>"BC"},
     {:name=>"6", :address=>"CANADA", :collection=>["LAND", "WATER", "OIL", "TREE", "SAND"], :sequence=>"CD"},
     {:name=>"29", :address=>"GERMANY", :collection=>["LAPTOP", "SHIP", "MOUNTAIN"], :sequence=>"DE"},
     {:name=>"30", :address=>"CHINA", :collection=>["LAPTOP", "SHIP", "MOUNTAIN"], :sequence=>"FG"}
    ]

My **Desired array of hashes** should look like this

    [
       {:name=>"1", :address=>"USA", :collection=>["LAND", "WATER", "OIL", "TREE", "SAND"], :sequence=>"AB"},
       {:name=>"5-6", :address=>"UK,CANADA", :collection=>["LAND", "WATER", "OIL", "TREE", "SAND"], :sequence=>"BC,CD"},
       {:name=>"29-30", :address=>"GERMANY,CHINA", :collection=>["LAPTOP", "SHIP", "MOUNTAIN"], :sequence=>"DE, FG"},
    ]

What I did so far

    new_array_of_hashes = []
    new_array_of_hashes << { name: array_of_hashes.map {|h| h[:name].to_i}} << {address: array_of_hashes.map {|h| h[:address]}} << {collection: array_of_hashes.map {|h| h[:collection]}} << {sequence: array_of_hashes.map {|h| h[:sequence]}}

    [{:name=>[1, 5, 6, 29, 30]},
     {:address=>["USA", "UK", "CANADA", "GERMANY", "CHINA"]},
     {:collection=>
    [["LAND", "WATER", "OIL", "TREE", "SAND"],
    ["LAND", "WATER", "OIL", "TREE", "SAND"],
    ["LAND", "WATER", "OIL", "TREE", "SAND"],
    ["LAPTOP", "SHIP", "MOUNTAIN"],
    ["LAPTOP", "SHIP", "MOUNTAIN"]]},
     {:sequence=>["AB", "BC", "CD", "DE", "FG"]}]

I am only able to combine it.