class Rack::QueryParser::Params
def to_h
key to it is non-deterministic.
getting the hash representation while another thread is adding a
through the `#[]=` method, it is not thread safe. The result of
3. Because the `Params` object's internal representation is mutable
representation, not a copy.
2. The value you get back is a reference to the internal hash
objects in order to save object allocations.
1. This method mutates the internal representation of the `Params`
Mutation warning!
purely of Ruby primitives.
(Ruby hashes) in place of the objects. The result is a hash consisting
of the same shape, but using the objects' internal representations
Recursively unwraps nested `Params` objects and constructs an object
def to_h @params.each do |key, value| case value when self # Handle circular references gracefully. @params[key] = @params when Params @params[key] = value.to_h when Array value.map! { |v| v.kind_of?(Params) ? v.to_h : v } else # Ignore anything that is not a `Params` object or # a collection that can contain one. end end @params end