Sha256: 7cdf308039e84cca985502076fc56a7073c06266d104ecc8822baa4bc05e3f90

Contents?: true

Size: 393 Bytes

Versions: 14

Compression:

Stored size: 393 Bytes

Contents

module SwiftypeAppSearch
  module Utils
    extend self

    def stringify_keys(hash)
      hash.each_with_object({}) do |(key, value), out|
        out[key.to_s] = value
      end
    end

    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
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
swiftype-app-search-0.6.1 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.6.0 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.5.0 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.4.4 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.4.2 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.4.1 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.4.0 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.3.0 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.2.0 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.1.4 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.1.3 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.1.2 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.1.1 lib/swiftype-app-search/utils.rb
swiftype-app-search-0.1.0 lib/swiftype-app-search/utils.rb