Module: Aggregations::Helpers::AbstractAggregationHelper

Overview

A helper module for aggregations, defines sub aggregation attributes.

Instance Method Summary collapse

Instance Method Details

#abstract_agg_builderObject

helper method to add abstract aggregation attributes to aggregation.



8
9
10
11
12
# File 'lib/aggregations/helpers/abstract_aggregation_helper.rb', line 8

def abstract_agg_builder
  builder = {}
  builder[:aggs] = build_sub_aggs_struct if @sub_aggregations.present?
  builder
end

#sub_aggregation(sub_agg) ⇒ AbstractAggregationHelper

Returns : aggregation object.

Parameters:

Returns:



16
17
18
19
20
# File 'lib/aggregations/helpers/abstract_aggregation_helper.rb', line 16

def sub_aggregation(sub_agg)
  @sub_aggregations = [] if @sub_aggregations.nil?
  @sub_aggregations = @sub_aggregations.append(sub_agg)
  self
end

#sub_aggregation_exprAbstractAggregationHelper

Returns : aggregation object.

Returns:



23
24
25
# File 'lib/aggregations/helpers/abstract_aggregation_helper.rb', line 23

def sub_aggregation_expr
  @sub_aggregations
end