简体   繁体   English

Ruby:如何访问模块>模块>类中的方法

[英]Ruby: How can i access method inside a module>module>class

Suppose there is a code like that : 假设有这样的代码:

module A
  module AB
    class ABC
      def one
        ....
      end

      def two
        ...
      end
.........
.........

Now how can i access method "one" , "two" etc from other ruby file? 现在如何从其他红宝石文件访问方法“一个”,“两个”等?

Thanks in advance. 提前致谢。

您可以这样调用方法:

A::AB::ABC.new.one

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM