Module: Rollbar::Util::Hash
- Defined in:
- lib/rollbar/util/hash.rb
Class Method Summary collapse
Class Method Details
.deep_stringify_keys(hash) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/rollbar/util/hash.rb', line 4 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 |
.map_value(thing, m) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rollbar/util/hash.rb', line 12 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 |