It does in fact work for instance variables, the syntax is just not as
common.


On Wed, Oct 2, 2013 at 5:31 PM, Doug Jolley <lists / ruby-forum.com> wrote:

> The following statement is made in the pick ax book:
>
> We'll use the # character in the string to interpolate the value of
> these instance variables.
>
> class Song
>   def to_s
>     "Song: #@name--#@artist (#@duration)"
>   end
> end
>
> If I had been doing what they appear to be doing, I would have enclosed
> the respective variable names in braces.  I'm sure that they are trying
> to tell me something by omitting the braces; but, I'm not sure what.  In
> fact, without the braces, I don't see how it even works.  Can someone
> please clarify for me how they are able to omit the braces and the
> significance of doing so?  Thanks for any input.
>
>       ... doug
>
> --
> Posted via http://www.ruby-forum.com/.
>



-- 
Jonan Scheffler
@1337807 <http://twitter.com/1337807>
jonanscheffler / gmail.com
(503) 985-6626