module SwiftypeAppSearch::Utils

Public Instance Methods

stringify_keys(hash) click to toggle source
# File lib/swiftype-app-search/utils.rb, line 5
def stringify_keys(hash)
  hash.each_with_object({}) do |(key, value), out|
    out[key.to_s] = value
  end
end
symbolize_keys(hash) click to toggle source
# File lib/swiftype-app-search/utils.rb, line 11
def symbolize_keys(hash)
  hash.each_with_object({}) do |(key, value), out|
    new_key = key.respond_to?(:to_sym) ? key.to_sym : key
    out[new_key] = value
  end
end