From: Aldo Italo Date: 2010-08-28T00:16:09+09:00 Subject: create dinamically hashes from string hi, i have a cookie with various data, i want to convert it in an hash. the data contain in the cookie are grouped by ";" and every group have a summary (which i want to convert to a name variable hash, it's separated on the left items by a "-") and various property:value (separated by comma): my_cookie = "my_first_group_title-property1:value1,property2:value2,property3:value3,property4:value4; my_second_group_title-blue:property1:value1,property2:value2" def cookie_to_hashes(item) if item item.split(";").each do |group| this_hash = {} group_array = group.split("-") group_array.last.split(",").each do |i| items = i.split(":") this_hash[items.first] = items.last end p this_hash end end end test = cookie_to_hashes(my_cookie) the method i have write works fine, but now i want to retrieve the hashes out of the method, using the names of the summary. in practice i want to obtain this: test = cookie_to_hashes(my_cookie) puts @property1 puts @property2 how can i retrive an istance variable set with the summary string? -- Posted via http://www.ruby-forum.com/.