Bug #11983
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
## Steps **Steps to Reproduce: Reproduce:** Inside irb: ~~~ruby Class A end A.send(:define_method, "may_run!?") do |*args, &block| p "random text" end a = A.new a.may_run!? ~~~ * never return from this function. ----------------------------------------------- IF I try to declare this function using `class_eval` ~~~ruby class_eval A.class_eval <<-EQRUBY def may_run!? p 'some text' end EQRUBY end ~~~ I got error: `syntax syntax error, unexpected '?', expecting ';' or '\n'`. '\n'. I think `class_eval` class_eval behaviour is right because `may_run!?` may_run!? is invalid name for method and `define_method` define_method should raise error instead of defining it.