Module: Elastic::EnterpriseSearch::Utils

Included in:
Client, WorkplaceSearch::Client
Defined in:
lib/elastic/enterprise-search/utils.rb

Overview

Util functions

Constant Summary collapse

DEFAULT_HOST =
'http://localhost:3002'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.symbolize_keys(hash) ⇒ Object



34
35
36
37
38
39
# File 'lib/elastic/enterprise-search/utils.rb', line 34

def self.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

Instance Method Details

#stringify_keys(hash) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/elastic/enterprise-search/utils.rb', line 26

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