Spec-Zone.ru › Ruby on Rails 8.0

класс ActionDispatch::ParamBuilder

Родитель:
Object

Константы

LEADING_BRACKETS_COMPAT

Атрибуты

param_depth_limit[R]

Публичные методы класса

make_default(param_depth_limit) Показать исходный код
# File actionpack/lib/action_dispatch/http/param_builder.rb, line 9
def self.make_default(param_depth_limit)
  new param_depth_limit
end

– Данная реализация основана на Rack::QueryParser, Copyright © 2007-2021 Leah Neukirchen <leahneukirchen.org/infopage.html>

new(param_depth_limit) Показать исходный код
# File actionpack/lib/action_dispatch/http/param_builder.rb, line 15
def initialize(param_depth_limit)
  @param_depth_limit = param_depth_limit
end

Публичные методы экземпляра

from_hash(hash, encoding_template: nil) Показать исходный код
# File actionpack/lib/action_dispatch/http/param_builder.rb, line 50
def from_hash(hash, encoding_template: nil)
  # Force encodings from encoding template
  hash = Request::Utils::CustomParamEncoder.encode_for_template(hash, encoding_template)

  # Assert valid encoding
  Request::Utils.check_param_encoding(hash)

  # Convert hashes to HWIA (or UploadedFile), and deep-munge nils
  # out of arrays
  hash = Request::Utils.normalize_encode_params(hash)

  hash
end
from_pairs(pairs, encoding_template: nil) Показать исходный код
# File actionpack/lib/action_dispatch/http/param_builder.rb, line 34
def from_pairs(pairs, encoding_template: nil)
  params = make_params

  pairs.each do |k, v|
    if Hash === v
      v = ActionDispatch::Http::UploadedFile.new(v)
    end

    store_nested_param(params, k, v, 0, encoding_template)
  end

  params
rescue ArgumentError => e
  raise InvalidParameterError, e.message, e.backtrace
end
from_query_string(qs, separator: nil, encoding_template: nil) Показать исходный код
# File actionpack/lib/action_dispatch/http/param_builder.rb, line 30
def from_query_string(qs, separator: nil, encoding_template: nil)
  from_pairs QueryParser.each_pair(qs, separator), encoding_template: encoding_template
end

© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API