module Lurker::Utils

Public Instance Methods

stringify_keys(object) click to toggle source
# 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