Class: Alf::Aggregator::Min
- Inherits:
-
Alf::Aggregator
- Object
- Alf::Aggregator
- Alf::Aggregator::Min
- Defined in:
- lib/alf-aggregator/alf/aggregator/min.rb
Overview
Defines a ‘min()` aggregation operator.
Example:
# direct ruby usage
Alf::Aggregator.min{ qty }.aggregate(...)
# lispy
(summarize :supplies, [:sid], :max => min{ qty })
Instance Attribute Summary
Attributes inherited from Alf::Aggregator
Instance Method Summary collapse
-
#_happens(memo, val) ⇒ Object
Aggregates on a tuple occurence through ‘memo < val ? memo : val`.
-
#least ⇒ Object
Returns nil as least value.
Methods inherited from Alf::Aggregator
#==, #aggregate, coerce, #default_options, #finalize, #happens, #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, val) ⇒ Object
Aggregates on a tuple occurence through ‘memo < val ? memo : val`
26 27 28 |
# File 'lib/alf-aggregator/alf/aggregator/min.rb', line 26 def _happens(memo, val) memo.nil? ? val : (memo < val ? memo : val) end |
#least ⇒ Object
Returns nil as least value.
19 20 21 |
# File 'lib/alf-aggregator/alf/aggregator/min.rb', line 19 def least() nil end |