From: "nobu (Nobuyoshi Nakada)" Date: 2013-09-07T04:02:00+09:00 Subject: [ruby-core:57049] [ruby-trunk - Bug #8870] Method-Missing breaking irb Issue #8870 has been updated by nobu (Nobuyoshi Nakada). Array#flatten tries to call #to_ary method on non-Array arguments, but the result of `m.to_s' doesn't have it, so the method_missing is called, and continues infinitely. In short, do not redefine global method_missing method. ---------------------------------------- Bug #8870: Method-Missing breaking irb https://bugs.ruby-lang.org/issues/8870#change-41654 Author: bjhaid (Ayodele Abejide) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN 2.0.0p247 :001 > def method_missing m,*args; [m.to_s,args].flatten.join " "; end => nil 2.0.0p247 :002 > "j".happy "hh" 2.0.0p247 :001 > def method_missing *args; args.join " "; end => nil 2.0.0p247 :002 > "j".happy SystemStackError: stack level too deep from /Users/bjhaid/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/workspace.rb:86 Maybe IRB bug! 2.0.0p247 :003 > def method_missing m,*args; args.join " "; end Segmentation fault: 11 2.0.0p247 :001 > def method_missing m,*args; [m,args].flatten " "; end => nil 2.0.0p247 :002 > "j".happy hah Segmentation fault: 11 -- http://bugs.ruby-lang.org/