class Rack::QueryParser::Params
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/rack/query_parser.rbs class Rack::QueryParser::Params def initialize: (Integer limit) -> void def to_h: () -> Hash end
def [](key)
def [](key) @params[key] end
def []=(key, value)
def []=(key, value) @size += key.size if key && !@params.key?(key) raise ParamsTooDeepError, 'exceeded available parameter key space' if @size > @limit @params[key] = value end
def initialize(limit)
Experimental RBS support (using type sampling data from the type_fusion
project).
def initialize: (Integer limit) -> void
This signature was generated using 1 sample from 1 application.
def initialize(limit) @limit = limit @size = 0 @params = {} end
def key?(key)
def key?(key) @params.key?(key) end
def to_h
Experimental RBS support (using type sampling data from the type_fusion
project).
def to_h: () ->
This signature was generated using 2 samples from 1 application.
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