Class: Bmg::Summarizer::DistinctCount
- Inherits:
-
Bmg::Summarizer
- Object
- Bmg::Summarizer
- Bmg::Summarizer::DistinctCount
- Defined in:
- lib/bmg/summarizer/distinct_count.rb
Overview
Collect the count of distinct values.
Example:
# direct ruby usage
Bmg::Summarizer.distinct_count(:qty).summarize(...)
Instance Attribute Summary
Attributes inherited from Bmg::Summarizer
Instance Method Summary collapse
-
#_happens(memo, val) ⇒ Object
Adds val to the memo array.
- #finalize(memo) ⇒ Object
-
#least ⇒ Object
Returns [] as least value.
Methods inherited from Bmg::Summarizer
avg, bucketize, by_proc, collect, concat, count, distinct, distinct_count, 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
Adds val to the memo array
19 20 21 22 |
# File 'lib/bmg/summarizer/distinct_count.rb', line 19 def _happens(memo, val) memo[val] = true memo end |
#finalize(memo) ⇒ Object
24 25 26 |
# File 'lib/bmg/summarizer/distinct_count.rb', line 24 def finalize(memo) memo.keys.size end |
#least ⇒ Object
Returns [] as least value.
14 15 16 |
# File 'lib/bmg/summarizer/distinct_count.rb', line 14 def least() {} end |