What about using a "here document"?

irb(main):013:0> foo=<<HERE
irb(main):014:0" select *
irb(main):015:0" from foo
irb(main):016:0" where someval='bar'
irb(main):017:0" HERE
=> "select *\nfrom foo\nwhere someval='bar'\n"
irb(main):018:0> print(foo)
select *
from foo
where someval='bar'
=> nil
irb(main):019:0>


-sean


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris McMahon
Sent: Monday, November 28, 2005 2:05 PM
To: [email protected]
Subject: [Wtr-general] OT: silly format question: get Ruby to ignore line
ends for long lines?

Hi all...

Is there a way to get Ruby to ignore line ends in a long text string
for readabiliy purposes, for instance a long SQL query?

"
select
        *
  from
        LIB.ACCOUNTs accounts,
        LIB.SSNS ssns,
        LIB.PLANS plans
 where
        accounts.FOO_KEY = ssns.BAR_KEY
   and  plan.BAZ_KEY = ssns.BAR_KEY
   and  ssns.DEPCD = ''
   and ... ETC ETC ETC
"

Thanks for your patience...
-Chris

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to