Sha256: 36858d36b867d29425547f481c82646c82add3bd4557b52d1a431587803d4474

Contents?: true

Size: 537 Bytes

Versions: 7

Compression:

Stored size: 537 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

module Github
  # Normalize client-supplied parameter keys.
  module Normalizer
    # Turns any keys from nested hashes including nested arrays into strings
    def normalize!(params)
      case params
      when Hash
        params.keys.each do |k|
          params[k.to_s] = params.delete(k)
          normalize!(params[k.to_s])
        end
      when Array
        params.map! do |el|
          normalize!(el)
        end
      end
      params
    end
  end # Normalizer
end # Github

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
github_api2-1.0.1 lib/github_api2/normalizer.rb
github_api2-1.0.0 lib/github_api2/normalizer.rb
github_api-0.19.0 lib/github_api/normalizer.rb
lingfennan-github_api-0.18.2 lib/github_api/normalizer.rb
github_api-0.18.2 lib/github_api/normalizer.rb
github_api-0.18.1 lib/github_api/normalizer.rb
github_api-0.17.0 lib/github_api/normalizer.rb