Created
May 21, 2011 20:18
-
-
Save mfn/984864 to your computer and use it in GitHub Desktop.
Have an uri give me a hash with all it's components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
require 'pp' | |
uri = URI.parse "http://foo/bar?baz&frob#blamp" | |
pp uri.component.each_with_object({}).find_all { |c,h| h[c] = uri.send(c) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gives: