Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
o = Object.new def o.method_missing(m,*args) puts "xxxxxxx #{m}" end p o.some_method
覆盖方法的基本过程是什么?
新方法如何知道我正在调用缺少的方法
如果一个被调用的方法没有被定义,它可以告诉你正在调用一个缺失的方法。
它如何打印新方法的输出?
通过执行新定义的方法。
如何被some_method视为m论据?
some_method
m
按设计。