为什么Ruby文档中的方法之前是哈希符号? [英] Why are methods in Ruby documentation preceded by a hash sign?
本文介绍了为什么Ruby文档中的方法之前是哈希符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一段时间以来一直阻碍我的事情。当我看到文本中打印的任何Ruby方法,通常显示为:
This is something that has been bugging me for a while. When I see any Ruby method printed in text, it usually appears as:
Class#method
或
#method
现在,我将使用:
Class.method
为什么Ruby方法之前都有一个井号?有什么理由吗?只是好奇。
Why are all Ruby methods preceded by a pound sign? Is there any reason for it? Just curious.
推荐答案
从 rdoc docs :
类,源文件的名称和
任何包含
下划线或之前的散列
字符的方法名称都将自动从
超链接到注释文本到
描述。
Names of classes, source files, and any method names containing an underscore or preceded by a hash character are automatically hyperlinked from comment text to their description.
(加重加重)
这篇关于为什么Ruby文档中的方法之前是哈希符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文