Module: Lurker::Utils

Included in:
Endpoint
Defined in:
lib/lurker/utils.rb

Class Method Summary collapse

Class Method Details

.stringify_keys(object) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/lurker/utils.rb', line 5

def stringify_keys(object)
  case object
  when Hash
    object.each_with_object({}) do |(key, value), memo|
      memo[key.to_s] = stringify_keys(value)
    end
  when Array
    object.map { |value| stringify_keys(value) }
  else
    object
  end
end