How do I use heredocs

(Daniel Sheppard) #1

EOS must be the ONLY thing on the line - it's not allowed to have
trailing whitespace.

It appears you've got about 10 whitespace characters after EOS.

···

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of hsun
Sent: Friday, 12 August 2005 6:24 AM
To: ruby-talk ML
Subject: How do I use heredocs

Hi,

I have a simple test program.

====================
class QuickTest
    
    def testMe
        str = <<EOS
         Some Application data
EOS
        puts str
    end
  
end

if $0 == __FILE__ then

    $test = QuickTest.new
    $test.testMe
end

I got this error and could not figure out what's wrong?

==============================================
QuickTest.rb:21: can't find string "EOS" anywhere before EOF
QuickTest.rb:6: syntax error

Can someone help?

I am running Ruby 1.8 on Windows XP

Thanks

#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################