Dynamic assignment of instance variables

Christoph [mailto:chr_mail@gmx.net] verified:

Well with 1.8.1 you get


class Fixnum
def bla=(rhs)
@bla = rhs
end
def bla
p @bla
end
end

2.bla = true
3.bla = false

2.bla # true

simply cool.
Thanks for the tip Christoph and Mark!

/Christoph

kind regards -botp