From: Ilias Lazaridis Date: 2011-06-02T13:00:29+09:00 Subject: Re: CORE - Alternative Variable Substitution On 1 Ιούν, 18:07, Christopher Dicely wrote: > On Wed, Jun 1, 2011 at 1:15 AM, Ilias Lazaridis wrote: > > ruby 1.9 > > > prints "#{name} has 5 credits" > > > Is there any *existent* library (ruby 1.9) availbale, which enables an > > alternative variable substitution, like e.g. > > > prints "&name has 5 credits" > > I don't know of anything that that modifies the behavior of String > that way, [...] ...or in a similar way ("&name" was just an example). > On the other hand, Ruby has a wide variety of templating libraries [...] > Also, as you are probably aware (though newbies reading may not be), > Ruby already provides a shortcut interpolation of the kind you ask > for, but only for instance variables, not locals (e.g., instead of > "@foo is #{@foo}" you can use "@foo is #@foo".) I understand, for local variables only: print "#@name has 5 credits" . -- http://lazaridis.com