Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 从可寻址对象获取完整URI?_Ruby_Addressable Gem - Fatal编程技术网

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/"

看。

哦,天哪。很简单,但我想不出来。谢谢