Module: SwiftypeAppSearch::Utils
Instance Method Summary collapse
Instance Method Details
#stringify_keys(hash) ⇒ Object
5 6 7 8 9 |
# 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) ⇒ Object
11 12 13 14 15 16 |
# 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 |