我想修改现有的ruby代码,而ruby不是我的第一个语言。该部分代码如下图所示:访问模块ruby模块中的方法
#someFile1.rb
module A
module B
def somefunction()
end
end
end
class X::Y
include A::B
end
#someFile2.rb
module A
module C
def anotherfunction()
#somefunction() <-- error
end
end
end
class X::Y
include A::C
end
不知怎的,我不能在anotherfunction
访问方法somefunction()
。 如何在模块C中的方法中访问模块B中定义的方法?为什么它不起作用?
情况不明确。您需要添加更多才能清楚。 – sawa 2014-10-02 10:07:00
@sawa我已经更新了这个问题,现在还不清楚吗? – dieend 2014-10-03 02:22:59