Module: Aggregations::Helpers::ValuesSourceAggregationHelper

Instance Method Summary collapse

Instance Method Details

#field(field) ⇒ ValuesSourceAggregationHelper

Parameters:

  • field (String)

Returns:



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

def field field
  @field = field
  self
end

#field_exprString

Returns:

  • (String)


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

def field_expr
  @field
end

#missing(missing) ⇒ ValuesSourceAggregationHelper

Parameters:

  • (String)

Returns:



41
42
43
44
# File 'lib/aggregations/helpers/values_source_aggregation_helper.rb', line 41

def missing missing
  @missing = missing
  self
end

#missing_exprString

Returns:

  • (String)


47
48
49
# File 'lib/aggregations/helpers/values_source_aggregation_helper.rb', line 47

def missing_expr
  @missing
end

#script(script) ⇒ ValuesSourceAggregationHelper

Parameters:

Returns:



29
30
31
32
# File 'lib/aggregations/helpers/values_source_aggregation_helper.rb', line 29

def script script
  @script = script
  self
end

#script_exprMisc::Script

Returns:



35
36
37
# File 'lib/aggregations/helpers/values_source_aggregation_helper.rb', line 35

def script_expr
  @script
end

#value_source_agg_builderObject

helper method to add values source attributes to aggregation.



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

def value_source_agg_builder
  builder = {}
  builder[:field] = @field if @field.present?
  builder[:script] = @script.settings if @script.present?
  builder[:missing] = @missing if @missing.present?
  builder
end