Sha256: 7774244a2cbe0669dd97c8cb9c50eadb15747461d7fb41c4f0d2b0416093218e

Contents?: true

Size: 488 Bytes

Versions: 5

Compression:

Stored size: 488 Bytes

Contents

module WebMock
  module Util
    class HashKeysStringifier
      
      def self.stringify_keys!(arg)
        case arg
        when Array
          arg.map { |elem| stringify_keys!(elem) }
        when Hash
          Hash[
            *arg.map { |key, value|  
              k = key.is_a?(Symbol) ? key.to_s : key
              v = stringify_keys!(value)
              [k,v]
            }.inject([]) {|r,x| r + x}]
        else
          arg
        end
      end
      
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
vanity-1.7.1 vendor/ruby/1.9.1/gems/webmock-1.6.4/lib/webmock/util/hash_keys_stringifier.rb
webmock-1.6.4 lib/webmock/util/hash_keys_stringifier.rb
webmock-1.6.2 lib/webmock/util/hash_keys_stringifier.rb
webmock-1.6.1 lib/webmock/util/hash_keys_stringifier.rb
webmock-1.6.0 lib/webmock/util/hash_keys_stringifier.rb