Reputation: 307
I'm trying to parse a URI with Ruby's URI library. This URI contains a #. For example, I have the URI: http://twitter.com/#!/dhh/status/26464821879
When I call URI.parse("http://twitter.com/#!/dhh/status/26464821879").path
"/" is returned, when I would expect to see "/#!/dhh/status/26464821879" returned.
How can I get URI.parse to properly return the path for this URI object?
Upvotes: 0
Views: 134
Reputation: 3500
this is not the path you want, it is the fragment
ruby-1.8.7-p174 > u = URI.parse("http://twitter.com/#!/dhh/status/26464821879")
=> #<URI::HTTP:0x10071add0 URL:http://twitter.com/#!/dhh/status/26464821879>
ruby-1.8.7-p174 > u.path
=> "/"
ruby-1.8.7-p174 > u.fragment
=> "!/dhh/status/26464821879"
Upvotes: 1