Module: Faraday::DecodeMethods
- Included in:
- NestedParamsEncoder
- Defined in:
- lib/faraday/encoders/nested_params_encoder.rb
Overview
Sub-module for decoding query-string into parameters.
Instance Method Summary collapse
-
#decode(query) ⇒ Array<Array, String>
The decoded params.
Instance Method Details
#decode(query) ⇒ Array<Array, String>
Returns the decoded params.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/faraday/encoders/nested_params_encoder.rb', line 87 def decode(query) return nil if query.nil? params = {} query.split('&').each do |pair| next if pair.empty? key, value = pair.split('=', 2) key = unescape(key) value = unescape(value.tr('+', ' ')) if value decode_pair(key, value, params) end dehash(params, 0) end |