Hom*_*ith 3 ruby addressable-gem
如果我有一个像这样的可寻址对象:
uri = Addressable::URI.parse("http://example.com/path/to/resource/")
Run Code Online (Sandbox Code Playgroud)
我如何回到" http://example.com/path/to/resource/ " - 我已经查看了uri.methods,但我没有看到我将使用哪一个来获取完整的URI.
使用to_s方法:
uri = Addressable::URI.parse("http://example.com/path/to/resource/")
uri.to_s
# => "http://example.com/path/to/resource/"
Run Code Online (Sandbox Code Playgroud)
请参阅URI- 基本示例.