class ElasticRecord::AggregationResponse::Builder

Constants

AGGREGATIONS_BY_TYPE
AGGREGATION_KLASSES

Public Class Methods

extract(hash) click to toggle source
# File lib/elastic_record/aggregation_response/builder.rb, line 44
def self.extract(hash)
  hash.each_with_object({}) do |(key, results), aggs|
    next unless key.include?('#')

    type, name = key.split('#')
    klass = AGGREGATIONS_BY_TYPE.fetch(type)
    aggs[name] = klass.new(name, results)
  end
end