[Rails] Re: Rails Syntax Change
Do you mean "#{base_title} | Home" is more efficient because it doesn't create a new String object? (You said second one... I am not sure if I got that right.)
(I wonder why I don't get email notifications when replies are sent... I am pretty sure I clicked "Email updates to me"...)
> New: "#{base_title} | Home"--
> Old: @base_title + "| Home"
Those statements do the exact same thing in ruby. The first example
injects a second string into the first string. The second example joins
two strings together--producing a third string. So the second example is
a tiny bit more efficient.
--
Posted via http://www.ruby-forum.com/.
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/kRvPL7Ht7PEJ.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home