On 1 =C9=EF=FD=ED, 11:13, Ilias Lazaridis <il... / lazaridis.com> 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"

class VarTester
  $g =3D "global"
  @@c =3D "class"

  def f
    "function"
  end

  def initialize
    @i =3D "instance"
    l =3D "local"
    puts "#$g #@@c #@i #l #f #{l} #{f}"
  end
end

VarTester.new

#=3D> global class instance #l #f local function

-

Related Issue:

Unify Variable Expansion within Strings
http://redmine.ruby-lang.org/issues/4877

.

--
http://lazaridis.com