Class: ActionDispatch::QueryParser
- Defined in:
- actionpack/lib/action_dispatch/http/query_parser.rb
Constant Summary collapse
- DEFAULT_SEP =
/& */n
- COMMON_SEP =
{ ";" => /; */n, ";," => /[;,] */n, "&" => /& */n, "&;" => /[&;] */n }
Class Method Summary collapse
-
.each_pair(s, separator = nil) ⇒ Object
– Note this departs from WHATWG’s specified parsing algorithm by giving a nil value for keys that do not use ‘=’.
- .strict_query_string_separator ⇒ Object
- .strict_query_string_separator=(value) ⇒ Object
Class Method Details
.each_pair(s, separator = nil) ⇒ Object
– Note this departs from WHATWG’s specified parsing algorithm by giving a nil value for keys that do not use ‘=’. Callers that need the standard’s interpretation can use ‘v.to_s`.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'actionpack/lib/action_dispatch/http/query_parser.rb', line 29 def self.each_pair(s, separator = nil) return enum_for(:each_pair, s, separator) unless block_given? s ||= "" splitter = if separator COMMON_SEP[separator] || /[#{separator}] */n else DEFAULT_SEP end s.split(splitter).each do |part| next if part.empty? k, v = part.split("=", 2) k = URI.decode_www_form_component(k) v &&= URI.decode_www_form_component(v) yield k, v end nil end |
.strict_query_string_separator ⇒ Object
11 12 13 14 15 16 |
# File 'actionpack/lib/action_dispatch/http/query_parser.rb', line 11 def self.strict_query_string_separator ActionDispatch.deprecator.warn <<~MSG The `strict_query_string_separator` configuration is deprecated have no effect and will be removed in Rails 8.2. MSG @strict_query_string_separator end |
.strict_query_string_separator=(value) ⇒ Object
18 19 20 21 22 23 |
# File 'actionpack/lib/action_dispatch/http/query_parser.rb', line 18 def self.strict_query_string_separator=(value) ActionDispatch.deprecator.warn <<~MSG The `strict_query_string_separator` configuration is deprecated have no effect and will be removed in Rails 8.2. MSG @strict_query_string_separator = value end |