【发布时间】:2016-04-28 06:55:04
【问题描述】:
我有一个用例,我有class A,其中包括module B。
class A
include B
def do_one_thing
# override module's method. do something different instead
end
def do_another_thing
# Call `do_one_thing` from here,
# but call the module's method, not the one I overrode above.
end
end
module B
included do
def do_one_thing
# ...
end
end
# some other methods
end
如上所示,我从do_another_thing 拨打do_one_thing。我的问题是我需要调用模块的方法(即super 方法)。这在 Rails 中可行吗?
【问题讨论】:
-
ruby super keyword的可能重复
标签: ruby-on-rails ruby inheritance module super