From: Ryan Davis Date: 2010-10-31T04:57:41+09:00 Subject: Re: Dynamically reference instance vars On Oct 30, 2010, at 12:27 , Greg Willits wrote: > I was hoping in Ruby that at least this was possible: > > myobject.send(iname) = ivalue > --or-- > myobject.send(iname, ivalue) You're confusing methods and variables. They're not the same, but you're on the right track with the code above, but you'd be calling the getter, not the setter. Check it: class X attr_accessor :x # creates x and x= methods end o = X.new o.send("x=", 42) p x