ruby self.included用法时间:2023-03-09 22:20:27 ===Module#included 当一个模块混入到类时,如果该模块的included方法已经定义,那么该方法被调用。该方法的唯一参数就是接受混含的类的名字。 module M def self.included(c) puts "I have justbeen mixed into #{c}." end end class C include M end 也就是说当类c中执行include M时,调用self.included方法