Sha256: b5d1b244f3285a87ac319a67b402d8cdb0e17f905d2b12bacdcae9ce3498cdae

Contents?: true

Size: 461 Bytes

Versions: 68

Compression:

Stored size: 461 Bytes

Contents

module Rollbar
  module Util
    module Hash
      def self.deep_stringify_keys(hash)
        hash.reduce({}) do |h, (key, value)|
          h[key.to_s] = map_value(value, :deep_stringify_keys)

          h
        end
      end

      def self.map_value(thing, m)
        case thing
        when ::Hash
          send(m, thing)
        when Array
          thing.map { |v| map_value(v, m) }
        else
          thing
        end
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
rollbar-2.18.2 lib/rollbar/util/hash.rb
rollbar-2.18.0 lib/rollbar/util/hash.rb
rollbar-2.17.0 lib/rollbar/util/hash.rb
rollbar-2.16.4 lib/rollbar/util/hash.rb
rollbar-2.16.3 lib/rollbar/util/hash.rb
rollbar-2.16.2 lib/rollbar/util/hash.rb
rollbar-2.16.0 lib/rollbar/util/hash.rb
rollbar-2.15.6 lib/rollbar/util/hash.rb
rollbar-2.15.5 lib/rollbar/util/hash.rb
rollbar-2.15.4 lib/rollbar/util/hash.rb
rollbar-2.15.3 lib/rollbar/util/hash.rb
rollbar-2.15.2 lib/rollbar/util/hash.rb
rollbar-2.15.1 lib/rollbar/util/hash.rb
rollbar-2.15.0 lib/rollbar/util/hash.rb
rollbar-2.14.1 lib/rollbar/util/hash.rb
rollbar-2.14.0 lib/rollbar/util/hash.rb
rollbar-2.13.3 lib/rollbar/util/hash.rb
rollbar-2.13.2 lib/rollbar/util/hash.rb
rollbar-2.13.1 lib/rollbar/util/hash.rb
rollbar-2.13.0 lib/rollbar/util/hash.rb