Class: Druid::PostAggregationOperation
- Inherits:
-
PostAggregation
- Object
- PostAggregation
- Druid::PostAggregationOperation
- Includes:
- PostAggregationOperators
- Defined in:
- lib/druid/post_aggregation.rb
Instance Attribute Summary
Attributes inherited from PostAggregation
#fieldName, #fieldNames, #fields, #fn, #function, #name, #numBuckets, #type, #value
Instance Method Summary collapse
- #as(field) ⇒ Object
- #field_names ⇒ Object
-
#initialize(left, operator, right) ⇒ PostAggregationOperation
constructor
A new instance of PostAggregationOperation.
Methods included from PostAggregationOperators
Methods inherited from PostAggregation
Constructor Details
#initialize(left, operator, right) ⇒ PostAggregationOperation
Returns a new instance of PostAggregationOperation.
141 142 143 144 145 146 147 148 149 |
# File 'lib/druid/post_aggregation.rb', line 141 def initialize(left, operator, right) super() @type = 'arithmetic' @fn = operator @fields = [ left.is_a?(Numeric) ? PostAggregationConstant.new(value: left) : left, right.is_a?(Numeric) ? PostAggregationConstant.new(value: right) : right, ] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Druid::PostAggregation
Instance Method Details
#as(field) ⇒ Object
151 152 153 154 |
# File 'lib/druid/post_aggregation.rb', line 151 def as(field) @name = field.fieldName.to_s self end |
#field_names ⇒ Object
156 157 158 |
# File 'lib/druid/post_aggregation.rb', line 156 def field_names fields.map(&:field_names).flatten.compact.uniq end |