StackOverflow 文件 Ruby Language 教程 方法缺失 捕獲對未定義方法的呼叫 捕獲對未定義方法的呼叫 Created: November-22, 2018 class Animal def method_missing(method, *args, &block) "Cannot call #{method} on Animal" end end => Animal.new.say_moo > "Cannot call say_moo on Animal" 與塊一起使用方法缺失