Class: Alf::Aggregator::Count
- Inherits:
-
Alf::Aggregator
- Object
- Alf::Aggregator
- Alf::Aggregator::Count
- Defined in:
- lib/alf-aggregator/alf/aggregator/count.rb
Overview
Defines a ‘count()` aggregation operator.
Example:
# direct ruby usage
Alf::Aggregator.count.aggregate(...)
# lispy
(summarize :supplies, [:sid], :num_orders => count)
Instance Attribute Summary
Attributes inherited from Alf::Aggregator
Instance Method Summary collapse
-
#happens(memo, tuple) ⇒ Object
Aggregates on a tuple occurence through ‘memo + 1`.
-
#least ⇒ Object
Returns 0 as least value.
Methods inherited from Alf::Aggregator
#==, #aggregate, coerce, #default_options, #finalize, #has_source_code!, #infer_type, inherited, #initialize, #to_lispy
Methods included from Support::Registry
#each, #listen, #listeners, #register, #registered
Constructor Details
This class inherits a constructor from Alf::Aggregator
Instance Method Details
#happens(memo, tuple) ⇒ Object
Aggregates on a tuple occurence through ‘memo + 1`
26 27 28 |
# File 'lib/alf-aggregator/alf/aggregator/count.rb', line 26 def happens(memo, tuple) memo + 1 end |
#least ⇒ Object
Returns 0 as least value.
19 20 21 |
# File 'lib/alf-aggregator/alf/aggregator/count.rb', line 19 def least() 0 end |