123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Request::Utils::ParamEncoder

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: actionpack/lib/action_dispatch/request/utils.rb

Class Method Summary

Class Method Details

.handle_array(params)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/request/utils.rb', line 71

def self.handle_array(params)
  params.map! { |el| normalize_encode_params(el) }
end

.normalize_encode_params(params)

Convert nested ::Hash to HashWithIndifferentAccess.

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/request/utils.rb', line 52

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
      hwia = ActiveSupport::HashWithIndifferentAccess.new
      params.each_pair do |key, val|
        hwia[key] = normalize_encode_params(val)
      end
      hwia
    end
  else
    params
  end
end