hashx = { key1 => {key1 => key1val1, key2 => key1val2}, key2 => {key1 =>
key2val1, key2 => key2val2} }

If I want to insert a hash in the 1st level, how to do?

key3_hash = {key1 => key3val1, key2 => key3val2}
hashx[key3] = key3_hash
# Is there a better way to write this? I want to assign the
programmatically

How about adding to the 2nd level hash?

Say
anon_hash = hashx[key1]
anon_hash[key3] = {key3 => key1val3}
hashx[key1] = anon_hash
# is there a better way to do this?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to