Sha256: 9ee81978a1763e819b96c0a7033fe26dd2dd7bd6f23b178609446d2373675729

Contents?: true

Size: 746 Bytes

Versions: 2

Compression:

Stored size: 746 Bytes

Contents

# frozen_string_literal: true

module HTTPX
  module Transcoder
    extend Registry

    def self.normalize_keys(key, value, &block)
      if value.respond_to?(:to_ary)
        if value.empty?
          block.call("#{key}[]")
        else
          value.to_ary.each do |element|
            normalize_keys("#{key}[]", element, &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, &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

2 entries across 2 versions & 1 rubygems

Version Path
httpx-0.10.2 lib/httpx/transcoder.rb
httpx-0.10.1 lib/httpx/transcoder.rb