From: Martin Sharon Date: 2009-04-27T12:32:10+09:00 Subject: Re: How to parse a "line"? it works! s.each instead of s.each_line thanks! Todd Benson wrote: > On Sun, Apr 26, 2009 at 9:47 PM, Todd Benson > wrote: >> >> In that case, you might try... >> >> h = {} >> f = my_string_list.each_line do |line| >> key = (value = line.split).shift >> h[key] = value >> end >> >> ...or something like that. > > It's late and I'm golfing with myself. Apologies to the list for this > almost one-liner... > > h = {} > s.each_line{|i|h[(v=i.split).shift]=v} -- Posted via http://www.ruby-forum.com/.