From: Charles Steinman Date: 2005-07-29T03:51:01+09:00 Subject: Re: Hash and multiline items Yannick Turgeon wrote: > Hello, > > I'm a newbie and I wanted to get a hash with items having multilines string. > Something like this (air coded) : > > SQL = { > "Company" => <<-END_SQL > SELECT Name > FROM Company > WHERE Active = 1 > END_SQL > , > "Employee" => <<-END_SQL > SELECT Name, Title > FROM Employee > WHERE Active = 1 > END_SQL > } > > But it doesn't work. I get an error. I suppose I have to use the "\" line > continuation? I prefer this synthaxe though. > > Is there a way to use the "labeled" multiline way in a hash? Any other style > suggestion? It looks like heredoc statements don't play well with Hashes. How does this strike your fancy? SQL = { "Company" => %q{ SELECT Name FROM Company WHERE Active = 1 }, "Employee" => %q{ SELECT Name, Title FROM Employee WHERE Active = 1 } }