Sha256: eebeaa91f835a240ce7e16a540c01491b00bd9cd78240190d652d7fb4df9d3fd

Contents?: true

Size: 580 Bytes

Versions: 21

Compression:

Stored size: 580 Bytes

Contents

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

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
      return params
    end

  end # Normalizer
end # BitBucket

Version data entries

21 entries across 21 versions & 5 rubygems

Version Path
codenamev_bitbucket_api-0.4.1 lib/bitbucket_rest_api/normalizer.rb
codenamev_bitbucket_api-0.4.0 lib/bitbucket_rest_api/normalizer.rb
zz_bitbucket_rest_api-0.1.11 lib/bitbucket_rest_api/normalizer.rb
zz_bitbucket_rest_api-0.1.10 lib/bitbucket_rest_api/normalizer.rb
zz_bitbucket_rest_api-0.1.9 lib/bitbucket_rest_api/normalizer.rb
zz_bitbucket_rest_api-0.1.8 lib/bitbucket_rest_api/normalizer.rb
bitbucket_rest_api2-0.9.5 lib/bitbucket_rest_api/normalizer.rb
bitbucket_rest_api2-0.9.1 lib/bitbucket_rest_api/normalizer.rb
bitbucket_rest_api2-0.2.2 lib/bitbucket_rest_api/normalizer.rb
bitbucket_rest_api2-0.2.1 lib/bitbucket_rest_api/normalizer.rb
bitbucket_rest_api2-0.2.0 lib/bitbucket_rest_api/normalizer.rb
bitbucket_rest_api-0.1.7 lib/bitbucket_rest_api/normalizer.rb
reenhanced_bitbucket_api-0.3.2 lib/bitbucket_rest_api/normalizer.rb
reenhanced_bitbucket_api-0.3.1 lib/bitbucket_rest_api/normalizer.rb
reenhanced_bitbucket_api-0.3.0 lib/bitbucket_rest_api/normalizer.rb
reenhanced_bitbucket_api-0.1.6 lib/bitbucket_rest_api/normalizer.rb
bitbucket_rest_api-0.1.5 lib/bitbucket_rest_api/normalizer.rb
bitbucket_rest_api-0.1.4 lib/bitbucket_rest_api/normalizer.rb
bitbucket_rest_api-0.1.2 lib/bitbucket_rest_api/normalizer.rb
bitbucket_rest_api-0.1.1 lib/bitbucket_rest_api/normalizer.rb