Sha256: dc73481f65b3653dad5453b50ea89e35fba8389bf5062c7676772fe1f4f44679

Contents?: true

Size: 574 Bytes

Versions: 35

Compression:

Stored size: 574 Bytes

Contents

# -*- encoding: utf-8 -*-

module Github
  # Deals with normalazing 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
      else
        params.to_s
      end
      return params
    end

  end # Normalizer
end # Github

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
github_api-0.11.3 lib/github_api/normalizer.rb
github_api-0.11.2 lib/github_api/normalizer.rb
github_api-0.11.1 lib/github_api/normalizer.rb
github_api-0.11.0 lib/github_api/normalizer.rb
github_api-0.10.2 lib/github_api/normalizer.rb
github_api-0.10.1 lib/github_api/normalizer.rb
github_api-0.10.0 lib/github_api/normalizer.rb
github_api-0.9.7 lib/github_api/normalizer.rb
github_api-0.9.6 lib/github_api/normalizer.rb
github_api-0.9.5 lib/github_api/normalizer.rb
github_api-0.9.4 lib/github_api/normalizer.rb
github_api-0.9.3 lib/github_api/normalizer.rb
github_api-0.9.2 lib/github_api/normalizer.rb
github_api-0.9.1 lib/github_api/normalizer.rb
github_api-0.9.0 lib/github_api/normalizer.rb
github_api-0.8.11 lib/github_api/normalizer.rb
github_api-0.8.10 lib/github_api/normalizer.rb
github_api-0.8.9 lib/github_api/normalizer.rb
github_api-0.8.8 lib/github_api/normalizer.rb
github_api-0.8.7 lib/github_api/normalizer.rb