6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/rquery_string/parser.rb', line 6
def self.parse(query_string)
hash_pair_array = query_string.split("&")
result_hash = Hash.new
hash_pair_array.each do |hash_value|
key, value = hash_value.split("=")
if is_array(key)
parse_array(key, value, result_hash)
elsif is_hash(key)
parse_hash(key, value, result_hash)
elsif is_string(value)
result_hash[parse_key(key)] = parse_string(value)
else
result_hash[parse_key(key)] = eval(value)
end
end
return result_hash
end
|