4
在ruby中,:: namespaces模块和类。 但我经常看到::在类名的开头如下所示:ruby中的类名之前的符号/运算符是什么?
#snippet of gollum gem
def page_class
@page_class ||
if superclass.respond_to?(:page_class)
superclass.page_class
else
::Gollum::Page
end
end
是什么::表示如果在开始?
的可能重复[这是什么className类<:: OtherClassName在Ruby中做什么?(http://StackOverflow.Com/questions/3302062/)和[什么: :MyClass Ruby范围运算符呢?](http://StackOverflow.Com/questions/3597096/)和其他人。 – 2010-09-08 11:11:40
http://stackoverflow.com/questions/3597096/what-does-myclass-ruby-scope-operator-do – agentbanks217 2010-09-08 10:38:35