Module: Summaryse
- Defined in:
- lib/summaryse.rb,
lib/summaryse/version.rb
Defined Under Namespace
Modules: Version
Constant Summary collapse
Class Method Summary collapse
-
.aggregator(name) ⇒ Object
Returns an aggregator by name, nil if no such aggregator as been previously registered.
-
.register(name, &lambda) ⇒ Object
Registers a aggregation function under a given name.
Class Method Details
.aggregator(name) ⇒ Object
Returns an aggregator by name, nil if no such aggregator as been previously registered.
27 28 29 |
# File 'lib/summaryse.rb', line 27 def self.aggregator(name) @aggregators && @aggregators[name] end |
.register(name, &lambda) ⇒ Object
Registers a aggregation function under a given name.
The lambda function is converted as a Proc from the supplied block. It takes one array argument, on which the aggregation must be done and returned.
18 19 20 21 |
# File 'lib/summaryse.rb', line 18 def self.register(name, &lambda) @aggregators ||= {} @aggregators[name] = lambda end |