On Jul 6, 2009, at 11:54 AM, RichardOnRails wrote:

>
> Hi,
>
> I posted at http://www.pastie.org/536025 four different continuation
> schemes for a lengthy statement.  The first three work fine,  but the
> fourth fails.  (The question arose as I was importing columnar
> positions for selected columnar headings in a CSV file.)
>
> Did I make a mistake or did the Ruby parser?

Fails how?  As is, with my install (ruby 1.8.6 (2008-08-11 patchlevel  
287) [universal-darwin9.0]) I get this for the 4th:

4.
  %s = %d
  %s = %d
  Date = 0

But don't get an error.  I think it's a precedence problem.  My guess  
is % binds tighter than +, but I haven't verified that.  Adding some  
()'s around the strings and it works like you'd expect.

   puts  ("4.\n %s = %d\n" +
           " %s = %d\n" +
           " %s = %d\n") % [
            :Date.to_s, date,
            :Description.to_s, description,
            :Amount.to_s, amount]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to