Ruby URI 的一个疑问

chenge · April 26, 2013 · Last by chenge replied at April 26, 2013 · 1704 hits

Net::HTTP.get(URI('http://www.example.com/index.html'))

URI 是 module,上面的代码中似乎是一个方法,为什么呢?

方法可以和 module 同名

module A;end
def A
  puts '和 module A 没关系'
end

#1 楼 @luikore 明白了,谢谢!

You need to Sign in before reply, if you don't have an account, please Sign up first.