Could someone point me to documentation that provides a succinct and
accurate description of the difference between interpolation using #{},
single quotes, and double quotes ?
I imagine there’s a set of precedence rules that govern behavior if/when
they’re mixed. I’d like to get clear on this.
Thank you, Chris. That’s exactly what I was looking for.
The lack of an index on the Ruby PDF drives me nuts. How do you find
this stuff?
Best regards,
Bill
----- Original Message -----
From: Chris H.
To: [email protected]
Sent: 2006-03-31 10:10 AM
Subject: Re: [Rails] string interpolation - #{} vs. single vs. double
quotes
On 3/31/06, Bill W. [email protected] wrote:
Could someone point me to documentation that provides a succinct and
accurate description of the difference between interpolation using #{},
single quotes, and double quotes ?
I imagine there's a set of precedence rules that govern behavior
if/when they’re mixed. I’d like to get clear on this.
Thanks,
Bill
_______________________________________________
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
Here documents can follow single-quote rules, if you single-quote the
here string (if that’s what it’s called) at the start:
question = <<‘ENDQ’
Could someone point me to documentation that provides a
succinct and accurate description of the difference between
interpolation using #{}, single quotes, and double quotes ?
ENDQ
Try this in IRB, and you’ll get:
=> “Could someone point me to documentation that provides a\nsuccinct
and accurate description of the difference between interpolation using
#{}, single quotes, and double quotes ?\n”
Thanks, Lukasz. I appreciate the help. I was hoping there was a short
answer. In reading the doc (now that you and Chris have helped me find
it)
it seems that I may need to explain (I’m working on a tutorial) the diff
between ‘evaluate’ and ‘substitute’ since single quotes do do some
substitution. Or maybe I’ll just say something like “In case A, use x.
In
case B, use y. In case C, buy the book.”
Thanks again,
Bill
----- Original Message -----
From: “Åukasz Piestrzeniewicz” [email protected]
To: [email protected]
Sent: 2006-03-31 10:09 AM
Subject: Re: [Rails] string interpolation - #{} vs. single vs. double
quotes
Thank you, Chris. That’s exactly what I was looking for.
The lack of an index on the Ruby PDF drives me nuts. How do you
find this stuff?
I’d recommend the Ruby for Rails book, all things make so much sense
afterwards. The agile web development book is great, but you never
learn the underpinnings of Rails.
Best regards
Peter De Berdt
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.