Hommer Smith
Hommer Smith

Reputation: 27852

Get back full URI from Addressable object?

If I have an addressable object like this:

uri = Addressable::URI.parse("http://example.com/path/to/resource/")

How would I get back the "http://example.com/path/to/resource/" - I have looked at uri.methods, but I fail to see which one would I use to get back the full URI.

Upvotes: 4

Views: 1874

Answers (1)

falsetru
falsetru

Reputation: 369134

Use to_s method:

uri = Addressable::URI.parse("http://example.com/path/to/resource/")
uri.to_s
# => "http://example.com/path/to/resource/"

See URI - basic example.

Upvotes: 9

Related Questions