Bill Walton
2006-Mar-31 15:57 UTC
[Rails] string interpolation - #{} vs. single vs. double quotes
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060331/27410325/attachment.html
Ćukasz Piestrzeniewicz
2006-Mar-31 16:15 UTC
[Rails] string interpolation - #{} vs. single vs. double quotes
In short: Double quotes and heredoc evaluate #{} SIngle quotes do not evaluate http://www.rubycentral.com/book/tut_stdtypes.html#S2 Regards, ?ukasz On 31/03/06, Bill Walton <bill.walton@charter.net> 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 > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- ?ukasz Piestrzeniewicz http://ragnarson.blogspot.com
Chris Hall
2006-Mar-31 16:16 UTC
[Rails] string interpolation - #{} vs. single vs. double quotes
http://www.rubycentral.com/book/tut_stdtypes.html http://www.rubycentral.com/book/language.html would be a good place to start. On 3/31/06, Bill Walton <bill.walton@charter.net> 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 > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060331/0fe510c6/attachment.html
Bill Walton
2006-Mar-31 16:47 UTC
[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? Best regards, Bill ----- Original Message ----- From: Chris Hall To: rails@lists.rubyonrails.org Sent: 2006-03-31 10:10 AM Subject: Re: [Rails] string interpolation - #{} vs. single vs. double quotes http://www.rubycentral.com/book/tut_stdtypes.html http://www.rubycentral.com/book/language.html would be a good place to start. On 3/31/06, Bill Walton <bill.walton@charter.net> 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 Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails ------------------------------------------------------------------------------ _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060331/81d7f087/attachment.html
Bill Walton
2006-Mar-31 16:58 UTC
[Rails] string interpolation - #{} vs. single vs. double quotes
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" <bragi.ragnarson@gmail.com> To: <rails@lists.rubyonrails.org> Sent: 2006-03-31 10:09 AM Subject: Re: [Rails] string interpolation - #{} vs. single vs. double quotes> In short: > > Double quotes and heredoc evaluate #{} > SIngle quotes do not evaluate > > http://www.rubycentral.com/book/tut_stdtypes.html#S2 > > Regards, > > ?ukasz > > On 31/03/06, Bill Walton <bill.walton@charter.net> 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 > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > -- > ?ukasz Piestrzeniewicz > http://ragnarson.blogspot.com >---------------------------------------------------------------------------- ----> _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Justin Forder
2006-Mar-31 20:00 UTC
[Rails] string interpolation - #{} vs. single vs. double quotes
?ukasz Piestrzeniewicz wrote:> Double quotes and heredoc evaluate #{}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" regards Justin
Peter De Berdt
2006-Apr-01 16:37 UTC
[Rails] string interpolation - #{} vs. single vs. double quotes
On 31 Mar 2006, at 18:32, Bill Walton wrote:> 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