Sha256: 7f11937a807ad2b15698ade29bc7014d47f5d0e95a719f118a230eb3a13bb04d

Contents?: true

Size: 845 Bytes

Versions: 21

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true

module HTTPX
  module Transcoder
    extend Registry

    def self.normalize_keys(key, value, cond = nil, &block)
      if (cond && cond.call(value))
        block.call(key.to_s, value)
      elsif value.respond_to?(:to_ary)
        if value.empty?
          block.call("#{key}[]")
        else
          value.to_ary.each do |element|
            normalize_keys("#{key}[]", element, cond, &block)
          end
        end
      elsif value.respond_to?(:to_hash)
        value.to_hash.each do |child_key, child_value|
          normalize_keys("#{key}[#{child_key}]", child_value, cond, &block)
        end
      else
        block.call(key.to_s, value)
      end
    end
  end
end

require "httpx/transcoder/body"
require "httpx/transcoder/form"
require "httpx/transcoder/json"
require "httpx/transcoder/chunker"

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
httpx-0.16.1 lib/httpx/transcoder.rb
httpx-0.16.0 lib/httpx/transcoder.rb
httpx-0.15.4 lib/httpx/transcoder.rb
httpx-0.15.3 lib/httpx/transcoder.rb
httpx-0.15.2 lib/httpx/transcoder.rb
httpx-0.15.1 lib/httpx/transcoder.rb
httpx-0.15.0 lib/httpx/transcoder.rb
httpx-0.14.5 lib/httpx/transcoder.rb
httpx-0.14.4 lib/httpx/transcoder.rb
httpx-0.14.3 lib/httpx/transcoder.rb
httpx-0.14.2 lib/httpx/transcoder.rb
httpx-0.14.1 lib/httpx/transcoder.rb
httpx-0.14.0 lib/httpx/transcoder.rb
httpx-0.13.2 lib/httpx/transcoder.rb
httpx-0.13.1 lib/httpx/transcoder.rb
httpx-0.13.0 lib/httpx/transcoder.rb
httpx-0.12.0 lib/httpx/transcoder.rb
httpx-0.11.3 lib/httpx/transcoder.rb
httpx-0.11.2 lib/httpx/transcoder.rb
httpx-0.11.1 lib/httpx/transcoder.rb