Class: Axiom::Aggregate
- Inherits:
-
Object
- Object
- Axiom::Aggregate
- Includes:
- AbstractType, Operation::Unary, Visitable
- Defined in:
- lib/axiom/aggregate.rb,
lib/axiom/aggregate/sum.rb,
lib/axiom/aggregate/mean.rb,
lib/axiom/aggregate/count.rb,
lib/axiom/aggregate/maximum.rb,
lib/axiom/aggregate/minimum.rb,
lib/axiom/aggregate/variance.rb,
lib/axiom/aggregate/standard_deviation.rb
Overview
Abstract class for aggregate functions
Defined Under Namespace
Classes: Count, Maximum, Mean, Minimum, StandardDeviation, Sum, Variance
Instance Attribute Summary
Attributes included from Operation::Unary
Class Method Summary collapse
-
.default ⇒ Object
Return the default accumulator.
-
.finalize(accumulator) ⇒ Object
Returns the value extracted from the accumulator.
Instance Method Summary collapse
-
#call(accumulator, tuple) ⇒ Object
Evaluate the aggregate using the provided Tuple.
-
#default ⇒ Object
Return the default for this aggregate.
-
#finalize(accumulator) ⇒ Object
Finalize the accumulator value.
Methods included from Visitable
Methods included from Operation::Unary
Class Method Details
.default ⇒ Object
Return the default accumulator
21 22 23 |
# File 'lib/axiom/aggregate.rb', line 21 def self.default self::DEFAULT end |
.finalize(accumulator) ⇒ Object
Returns the value extracted from the accumulator
Default behaviour is to pass-through the accumulator
35 36 37 |
# File 'lib/axiom/aggregate.rb', line 35 def self.finalize(accumulator) accumulator end |
Instance Method Details
#call(accumulator, tuple) ⇒ Object
Evaluate the aggregate using the provided Tuple
63 64 65 |
# File 'lib/axiom/aggregate.rb', line 63 def call(accumulator, tuple) self.class.call(accumulator, value(tuple)) end |
#default ⇒ Object
Return the default for this aggregate
47 48 49 |
# File 'lib/axiom/aggregate.rb', line 47 def default self.class.default end |
#finalize(accumulator) ⇒ Object
Finalize the accumulator value
75 76 77 |
# File 'lib/axiom/aggregate.rb', line 75 def finalize(accumulator) self.class.finalize(accumulator) end |