Remove array within hash

My orginal hash is like as

==> hash = {“sku_id”=>[4], “brand_active”=>[“true”],
“salesman_active”=>[“true”]}

How to remove the array within hash. that means to convert the hash like

==> {“sku_id”=>4, “brand_active”=>“true”, “salesman_active”=>“true”

Come on, why even ask this!? Check the doc for all essentials – Array,
Hash, String.

hash.each { |k,v| hash[k] = v[0] }

  • A

On Sep 2, 6:49 am, Manivannan J. [email protected] wrote:

==> hash = {“sku_id”=>[4], “brand_active”=>[“true”],
“salesman_active”=>[“true”]}

How to remove the array within hash.

In addition to Aleksey’s response re how to UNdo the arraying, would
it be possible simply to NOT put the data in as arrays in the first
place?

-Dave