如果main
用模块扩展对象,是否可以引用另一个对象中的新方法?
module Mod
def meth
puts "top level"
end
end
extend Mod # --- not include
class My
def meth
puts "instance"
TOP_LEVEL.meth # --- psuedo-code to explain the intention
end
end
My.new.meth # prints "instance", then fails