| Class | CGIMethods::FormEncodedPairParser |
| In: |
vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
|
| Parent: | StringScanner |
| KEY_REGEXP | = | %r{([^\[\]=&]+)} |
| BRACKETED_KEY_REGEXP | = | %r{\[([^\[\]=&]+)\]} |
| parent | [R] | |
| result | [R] | |
| top | [R] |
# File vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb, line 109
109: def initialize(pairs = [])
110: super('')
111: @result = {}
112: pairs.each { |key, value| parse(key, value) }
113: end
Parse the query string
# File vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb, line 119
119: def parse(key, value)
120: self.string = key
121: @top, @parent = result, nil
122:
123: # First scan the bare key
124: key = scan(KEY_REGEXP) or return
125: key = post_key_check(key)
126:
127: # Then scan as many nestings as present
128: until eos?
129: r = scan(BRACKETED_KEY_REGEXP) or return
130: key = self[1]
131: key = post_key_check(key)
132: end
133:
134: bind(key, value)
135: end