ruby -::(双冒号)在 Ruby 中是什么意思?

标签 ruby syntax operators

<分区>

:: 在 Ruby 中是什么意思?例如。 Foo::Bar.

最佳答案

From the Pickaxe :

When a receiver is explicitly specified in a method invocation, it may be separated from the method name using either a period (.) or two colons (::). The only difference between these two forms occurs if the method name starts with an uppercase letter. In this case, Ruby will assume that a receiver::Thing method call is actually an attempt to access a constant called Thing in the receiver unless the method invocation has a parameter list between parentheses.

关于ruby -::(双冒号)在 Ruby 中是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2276905/

相关文章:

c - If 语句中的 AND(&&) 是否按照我键入的顺序进行检查?

ruby-on-rails - 尝试显示图像时,出现错误 “404 not found”

ruby-on-rails - 'cucumber' 可以运行我的 rspec-on-rails 测试吗?

arrays - Ruby 数组 += vs 推送

c# - 功能(): this(null) {}

java - 同一件事得到不同的结果

ruby - Windows 应用程序数据目录

javascript - 使用数学优化使用 jQuery 修改 CSS 值的语法

Java 语法 : "synchronized (this)"

flutter - Dart/Flutter 中的运算符 "??"是什么意思?