Monday, July 13, 2009

Easy XML Response Strings in Ruby with Multi-line String

Using a multi-line String in Ruby is sometimes a good way of generating an XML response string. Thanks to Jim for the pointer to this operator:
        def self.get_some_xml(hash_in)
          resp = <<-eos<?xml version='1.0'?>'  
<myresponse version='1.0'> 
In the end though, I just used doublequote to start and end and changed all quotes to single quotes in the message.

More info at:

No comments: