Module: Web::Request

Defined in:
lib/web/forms.rb

Overview

:nodoc

Class Method Summary collapse

Class Method Details

.parse_typed_params(query_string) ⇒ Object



40
41
42
# File 'lib/web/forms.rb', line 40

def Request.parse_typed_params query_string
    Request.typed_params(Web::Request.parse_query_string(query_string))
end

.typed_params(params) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/web/forms.rb', line 18

def Request.typed_params params
    params2 = {}
    params.collect do |k,v|
	if ! (k =~ /type/)
	    if (atype = params["#{k}-type"][0]) 
		begin
		    params2[k] = eval(Web.unescape(atype)).unencode(v[0])
		rescue
		    params2[k] = eval(Web.unescape(atype)).unencode(Web.unescape(v[0]))
		end
	    else
		if v[0].kind_of? String
		    params2[k] = v[0]
		else
		    params2[k] = v[0]
		end
	    end
	end
    end
    params2
end