>>>>> "V" == Ville Mattila <mulperi / iki.fi> writes:

V>     eval("@" + name + "=" + value)

 This is expanded to

       eval "@name = baz"

 this is why it give an error message, you want probably something like
this 

       eval "@#{name} = #{value.inspect}"

 but it will not work in some case, i.e. when #inspect give something like
 this 

pigeon% ruby -e 'p Object.new.inspect'
"#<Object:0x4019fbf8>"
pigeon% 

V>   end
V> end

V> f = Foo.new
V> f.add_attr("bar", "baz")

 You can just write

   class << f
      attr_accessor :bar
   end
   f.bar = "baz"


Guy Decoux