Sha256: ad1e03e4d1506b0c454e10d4b2bcf73ed22b29de28aca407397c5fa275a76deb

Contents?: true

Size: 574 Bytes

Versions: 1

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true
module BitBucket
  # Deals with normalizing 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
      params
    end
  end # Normalizer
end # BitBucket

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitbuckets-0.2.0 lib/bitbucket_rest_api/normalizer.rb