I think you're getting a syntax error because this line expands into a string like `def Stupidedi::Foo::Bar.xyz` and sometimes `klass` won't actually have a name, so you'll get `def #<Class:0x038914>.xyz`. In any case, putting the class name in the method name that way will make it a "class method" and not an "instance method".

You might try doing something like this instead: `klass.class_eval(<<-RUBY, ...) def #{m}(value)`. This way `klass` is never converted to a string, and the method is still defined as an instance method.