Ruby 从可寻址对象获取完整URI?
如果我有这样一个可寻址对象:Ruby 从可寻址对象获取完整URI?,ruby,addressable-gem,Ruby,Addressable Gem,如果我有这样一个可寻址对象: uri = Addressable::URI.parse("http://example.com/path/to/resource/") 我如何取回“”-我已经查看了uri.methods,但是我看不出我将使用哪一个来取回完整的uri。使用来取回方法: uri = Addressable::URI.parse("http://example.com/path/to/resource/") uri.to_s # => "http://example.com/p
uri = Addressable::URI.parse("http://example.com/path/to/resource/")
我如何取回“”-我已经查看了uri.methods,但是我看不出我将使用哪一个来取回完整的uri。使用
来取回方法:
uri = Addressable::URI.parse("http://example.com/path/to/resource/")
uri.to_s
# => "http://example.com/path/to/resource/"
看。哦,天哪。很简单,但我想不出来。谢谢