Class: GRI::Request

Inherits:
Rack::Request
  • Object
show all
Defined in:
lib/gri/request.rb

Instance Method Summary collapse

Instance Method Details

#gparamsObject



16
17
18
# File 'lib/gri/request.rb', line 16

def gparams
  @gparams ||= gparse_query query_string
end

#gparse_query(qs) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/gri/request.rb', line 20

def gparse_query qs
  params = GParams.new
  (qs || '').split(/[&;] */n).each {|item|
    k, v = item.split('=', 2).map {|s| Rack::Utils.unescape s}
    params[k] = v
  }
  params
end

#query_stringObject



12
13
14
# File 'lib/gri/request.rb', line 12

def query_string
  @query_string || query_string0
end

#query_string0Object



11
# File 'lib/gri/request.rb', line 11

alias query_string0 query_string

#query_string=(s) ⇒ Object



6
7
8
9
# File 'lib/gri/request.rb', line 6

def query_string=(s)
  @query_string = s
  @gparams = @params = nil
end