Created
November 4, 2008 10:59
-
-
Save sharnik/22116 to your computer and use it in GitHub Desktop.
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
module ActionController | |
class AbstractRequest | |
class << self | |
def parse_query_parameters(query_string) | |
return {} if query_string.blank? | |
query_string = query_string.gsub("amp;", "") | |
pairs = query_string.split('&').collect do |chunk| | |
next if chunk.empty? | |
key, value = chunk.split('=', 2) | |
next if key.empty? | |
value = value.nil? ? nil : CGI.unescape(value) | |
[ CGI.unescape(key), value ] | |
end.compact | |
UrlEncodedPairParser.new(pairs).result | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment