module Solr::Support::HashExtensions

Public Instance Methods

symbolize_recursive(hash) click to toggle source
# File lib/solr/support/hash_extensions.rb, line 6
def symbolize_recursive(hash)
  {}.tap do |h|
    hash.each { |key, value| h[key.to_sym] = transform(value) }
  end
end

Private Instance Methods

deep_symbolize_keys() click to toggle source
# File lib/solr/support/hash_extensions.rb, line 23
def deep_symbolize_keys
  HashExtensions.symbolize_recursive(self)
end
transform(thing) click to toggle source
# File lib/solr/support/hash_extensions.rb, line 14
def transform(thing)
  case thing
  when Hash then symbolize_recursive(thing)
  when Array then thing.map { |v| transform(v) }
  else; thing
  end
end