Class: ActionDispatch::Request::Utils::ParamEncoder
- Inherits:
-
Object
- Object
- ActionDispatch::Request::Utils::ParamEncoder
- Defined in:
- lib/action_dispatch/request/utils.rb
Overview
:nodoc:
Direct Known Subclasses
Class Method Summary collapse
- .handle_array(params) ⇒ Object
-
.normalize_encode_params(params) ⇒ Object
Convert nested Hash to HashWithIndifferentAccess.
Class Method Details
.handle_array(params) ⇒ Object
61 62 63 |
# File 'lib/action_dispatch/request/utils.rb', line 61 def self.handle_array(params) params.map! { |el| normalize_encode_params(el) } end |
.normalize_encode_params(params) ⇒ Object
Convert nested Hash to HashWithIndifferentAccess.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/action_dispatch/request/utils.rb', line 44 def self.normalize_encode_params(params) case params when Array handle_array params when Hash if params.has_key?(:tempfile) ActionDispatch::Http::UploadedFile.new(params) else params.each_with_object({}) do |(key, val), new_hash| new_hash[key] = normalize_encode_params(val) end.with_indifferent_access end else params end end |