【发布时间】:2014-02-11 13:15:52
【问题描述】:
我知道,我可以这样覆盖模块中的类方法
class Foo
class << self
def some_static_method
puts 'some_static_method'
end
end
end
module BAR
class << Foo
def some_static_method
puts 'another_static_method'
end
end
end
class Foo
include BAR
end
Foo.some_static_method # => 'another_static_method'
实例方法可以吗?
【问题讨论】:
-
您可能会找到一些信息here。