Class: Bmg::Summarizer::Sum

Inherits:
Bmg::Summarizer show all
Defined in:
lib/bmg/summarizer/sum.rb

Overview

Sum summarizer.

Example:

# direct ruby usage
Bmg::Summarizer.sum(:qty).summarize(...)

Instance Attribute Summary

Attributes inherited from Bmg::Summarizer

#functor, #options

Instance Method Summary collapse

Methods inherited from Bmg::Summarizer

avg, bucketize, by_proc, collect, concat, count, distinct, distinct_count, #finalize, first, #happens, #initialize, last, max, median, median_cont, median_disc, min, multiple, percentile, percentile_cont, percentile_disc, stddev, sum, summarization, #summarize, #to_summarizer_name, value_by, variance

Constructor Details

This class inherits a constructor from Bmg::Summarizer

Instance Method Details

#_happens(memo, val) ⇒ Object

Keep memo+val as new value



19
20
21
# File 'lib/bmg/summarizer/sum.rb', line 19

def _happens(memo, val) 
  memo + (val.nil? ? 0 : val)
end

#leastObject

Returns 0 as least value.



14
15
16
# File 'lib/bmg/summarizer/sum.rb', line 14

def least()
  0
end