From: anilmaurya8dec@... Date: 2016-01-12T14:18:02+00:00 Subject: [ruby-core:72829] [Ruby trunk - Bug #11983] [Open] define_method not raising error for invalid method name Issue #11983 has been reported by Anil Maurya. ---------------------------------------- Bug #11983: define_method not raising error for invalid method name https://bugs.ruby-lang.org/issues/11983 * Author: Anil Maurya * Status: Open * Priority: Normal * Assignee: * ruby -v: * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- **Steps to Reproduce:** Inside irb: 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 A.class_eval <<-EQRUBY def may_run!? p 'some text' end EQRUBY end I got error: syntax error, unexpected '?', expecting ';' or '\n'. I think class_eval behaviour is right because may_run!? is invalid name for method and define_method should raise error instead of defining it. -- https://bugs.ruby-lang.org/ Unsubscribe: