On Mon, Aug 26, 2013 at 1:12 PM, Love U Ruby <[email protected]> wrote:

> In my case the hash is inside the string,but I want the hash back from
> the string? :( I don't know how to do this...

If you must use that format --

2.0.0-p247 :017 > str
 => "1=2,3=(4=5,6=7)"
2.0.0-p247 :018 > eval str.tr('()','{}').gsub(/=/,'=>').prepend('{').concat('}')
 => {1=>2, 3=>{4=>5, 6=>7}}
2.0.0-p247 :019 >


-- 
Hassan Schroeder ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yCmMq8D-FDgn3asD4ADDbZL3mSh-cxKWP_55V7D781dOg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to