【发布时间】:2026-01-13 15:15:01
【问题描述】:
如果我有这样的可寻址对象:
uri = Addressable::URI.parse("http://example.com/path/to/resource/")
我将如何取回“http://example.com/path/to/resource/” - 我查看了 uri.methods,但我没有看到我将使用哪个来取回完整的 URI。
【问题讨论】:
标签: ruby addressable-gem
如果我有这样的可寻址对象:
uri = Addressable::URI.parse("http://example.com/path/to/resource/")
我将如何取回“http://example.com/path/to/resource/” - 我查看了 uri.methods,但我没有看到我将使用哪个来取回完整的 URI。
【问题讨论】:
标签: ruby addressable-gem
使用to_s方法:
uri = Addressable::URI.parse("http://example.com/path/to/resource/")
uri.to_s
# => "http://example.com/path/to/resource/"
【讨论】: