Module: Summaryse

Defined in:
lib/summaryse.rb,
lib/summaryse/version.rb

Defined Under Namespace

Modules: Version

Constant Summary collapse

BYPASS =

Bypass marker

Object.new
VERSION =
Version.to_s

Class Method Summary collapse

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.

Parameters:

  • name (Symbol)

    a aggregation function name

  • the (lambda)

    function itself



18
19
20
21
# File 'lib/summaryse.rb', line 18

def self.register(name, &lambda)
  @aggregators ||= {}
  @aggregators[name] = lambda
end