Hello

I trying to do simple thing like this

class Foo  < Module
  def add_attr(name=nil,value=nil)
    attr_accessor eval(":" + name)
    eval("@" + name + "=" + value)
  end
end

f = Foo.new
f.add_attr("bar", "baz")
f.bar #-> "baz"
f.bar = "biz"
f.bar #-> "biz"

Unfortunately I just get

faa.rb:5:in `add_attr': (eval):1:in `add_attr': undefined local variable or meth
od `baz' for #<Module 0lxe51d0> (NameError)
        from faa.rb:10:in `eval'
        from faa.rb:5:in `add_attr'
        from faa.rb:10

When trying to execute the code above. What have I understood wrong?