like "as" keyword (for namespacing) in Ruby

I was just over looking at this question. The first thought that popped to my head was that ruby must have some sort of "as" type keyword like Python's import to help avoid namespace pollution. I've googled a bit but it seems that it's recommended to wrap your code in modules to avoid namespace problems with ruby. This seems problematic because what if two modules have conflicting names.

So, any "as" type keywords for ruby's require?


我一直在做的是用我公司的工作首字母缩写或我自己的个人项目首字母开头。

module JWG_TwitterTools
.
. 
.
end

In ruby 2.0, there will be mix (search for mix). But now, there is nothing like that... Simply use the full constant path.

链接地址: http://www.djcxy.com/p/48512.html

上一篇: 奇怪的行为围绕“相同的擦除”编译错误

下一篇: 像Ruby中的“as”关键字(用于命名空间)