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-1.4.2 lib/rollbar/util/hash.rb
rollbar-1.4.1 lib/rollbar/util/hash.rb
rollbar-1.4.0 lib/rollbar/util/hash.rb
rollbar-1.3.2 lib/rollbar/util/hash.rb
rollbar-1.3.1 lib/rollbar/util/hash.rb
rollbar-1.3.0 lib/rollbar/util/hash.rb
rollbar-1.2.13 lib/rollbar/util/hash.rb
rollbar-1.2.12 lib/rollbar/util/hash.rb