Module: Aggregations::Helpers::AbstractRangeHelper

Included in:
Buckets::DateRangeAggregationBuilder, Buckets::RangeAggregationBuilder
Defined in:
lib/aggregations/helpers/abstract_range_helper.rb

Instance Method Summary collapse

Instance Method Details

#abstract_range_builderObject

helper method to add abstract range attributes to aggregation.



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

def abstract_range_builder
  builder = {}
  builder[:ranges] = @ranges if @ranges.present?
  builder[:keyed] = @keyed if @keyed.present?
  builder
end

#add_range(range) ⇒ AbstractRangeHelper

Returns , can be chained for adding multiple ranges.

Parameters:

Returns:



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

def add_range range
  @ranges ||= []
  @ranges << range.settings
  self
end

#keyed(keyed) ⇒ Object

Parameters:

  • keyed (Boolean)


28
29
30
31
# File 'lib/aggregations/helpers/abstract_range_helper.rb', line 28

def keyed keyed
  @keyed = keyed
  self
end

#keyed_exprBoolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/aggregations/helpers/abstract_range_helper.rb', line 34

def keyed_expr
  @keyed
end

#ranges_exprArray

Returns:

  • (Array)


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

def ranges_expr
  @ranges
end