引用如下
include : mixes in specified module methods as instance methods in the target class
extend : mixes in specified module methods as class methods in the target class
记得有看过的,被用到的时候居然忘记了。杯具啊!
module Adef klass_methodputs 'klass method'enddef ins_methodputs 'instance method'endendclass B
endB.class_eval doinclude A
endB.new.ins_method # 'should puts instance method'
#B.klass_method # 'not define'B.class_eval doextend A
endB.klass_method # 'klass method'
B.ins_method # also as class method