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"
on 2010-09-02 12:49
on 2010-09-02 12:59
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 2010-09-07 19:31
On Sep 2, 6:49 am, Manivannan Jeganathan <li...@ruby-forum.com> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.