[..]
But... but... neither of you guys's version gives the same result as
Jonh'sI think this does:
Hash[*str.scan(/([^,]+)=([^,]+)/).flatten]
David
or
Hash[*str.split(/=|,/)]
cheers
Simon
[..]
But... but... neither of you guys's version gives the same result as
Jonh'sI think this does:
Hash[*str.scan(/([^,]+)=([^,]+)/).flatten]
David
or
Hash[*str.split(/=|,/)]
cheers
Simon
Hi --
On Wed, 26 Apr 2006, Kroeger, Simon (ext) wrote:
[..]
But... but... neither of you guys's version gives the same result as
Jonh'sI think this does:
Hash[*str.scan(/([^,]+)=([^,]+)/).flatten]
David
or
Hash[*str.split(/=|,/)]
Oh, right -- or that Another demonstration of the principle that
as one works on Ruby code it evaporates from the screen, *and* becomes
clearer rather than more cryptic.
David
--
David A. Black (dblack@wobblini.net)
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)
"Ruby for Rails" PDF now on sale! Ruby for Rails
Paper version coming in early May!