之间的区别.和 #
在 Ruby 中,这两者之间的区别是什么(在代码中):
In Ruby what is the difference between those two (in code):
Class.method
Class#method
散列格式 (Class#method) 不是有效的 ruby,但在文档中用于描述实例方法.
The hash format (Class#method) is not valid ruby, but is used in documentation to describe an instance method.
通常使用双冒号(Class::method)记录类方法.
Class methods are typically documented using a double-colon (Class::method).
您将在 ruby 文档中看到两者的示例(例如 http://www.ruby-doc.org/core-1.9.3/String.html)
You will see examples of both in the ruby docs (e.g. http://www.ruby-doc.org/core-1.9.3/String.html)
当实际调用一个类方法(Class.method)时,在代码中使用点格式,尽管我看到有些人(不幸地)将它与双冒号或散列互换使用文档.
The dot format is used in code when actually calling a class method (Class.method), though I have seen some people (unfortunately) use it interchangeably with either the double-colon or hash in documentation.