我正在尝试创建一个LWRP来扩展超市烹饪书'webpshere‘。
在我的资源文件中,我试图用父库克书中的一个基类来扩展这个类。
在下面的代码中,'WebsphereBase‘定义在父库'websphere_base’中。我能得到关于如何引用它的帮助吗?谢谢
#require 'websphere_base'
module PIWebsphereCookBook
class WebsphereJbdc < WebsphereBase
require_relative 'helper'发布于 2017-06-12 16:25:13
在食谱的来源中,可以看到WebsphereBase类是在WebsphereCookbook模块中定义的。
要从这个模块之外引用这个类,您必须为嵌套命名,以便Ruby能够找到您所引用的类。使用您的示例,这可能类似于:
module PIWebsphereCookBook
class WebsphereJbdc < WebsphereCookbook::WebsphereBase
require_relative 'helper'
# ...
end
endhttps://stackoverflow.com/questions/44504220
复制相似问题