class method self.each_pair

Ruby on Rails 8.1.2

Since v8.0.4

Available in: v8.0.4 v8.1.2

Signature

self.each_pair(s, separator = nil)

No documentation comment.

Parameters

s req
separator opt = nil
Source
# File actionpack/lib/action_dispatch/http/query_parser.rb, line 29
    def self.each_pair(s, separator = nil)
      return enum_for(:each_pair, s, separator) unless block_given?

      s ||= ""

      splitter =
        if separator
          COMMON_SEP[separator] || /[#{separator}] */n
        else
          DEFAULT_SEP
        end

      s.split(splitter).each do |part|
        next if part.empty?

        k, v = part.split("=", 2)

        k = URI.decode_www_form_component(k)
        v &&= URI.decode_www_form_component(v)

        yield k, v
      end

      nil
    end

Defined in actionpack/lib/action_dispatch/http/query_parser.rb line 29 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::QueryParser

Type at least 2 characters to search.

↑↓ navigate · open · esc close