Class: Bmg::Summarizer::Concat
- Inherits:
-
Bmg::Summarizer
- Object
- Bmg::Summarizer
- Bmg::Summarizer::Concat
- Defined in:
- lib/bmg/summarizer/concat.rb
Overview
String concatenation summarizer.
Example:
# direct ruby usage
Bmg::Summarizer.concat(:qty).summarize(...)
Instance Attribute Summary
Attributes inherited from Bmg::Summarizer
Instance Method Summary collapse
-
#_happens(memo, val) ⇒ Object
Concatenates current memo with val.to_s.
-
#default_options ⇒ Object
Sets default options.
-
#finalize(memo) ⇒ Object
Finalizes computation.
-
#least ⇒ Object
Returns least value (defaults to “”).
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
Concatenates current memo with val.to_s
24 25 26 27 |
# File 'lib/bmg/summarizer/concat.rb', line 24 def _happens(memo, val) memo << [:between].to_s unless memo.empty? memo << val.to_s end |
#default_options ⇒ Object
Sets default options.
14 15 16 |
# File 'lib/bmg/summarizer/concat.rb', line 14 def {:before => "", :after => "", :between => ""} end |
#finalize(memo) ⇒ Object
Finalizes computation
30 31 32 |
# File 'lib/bmg/summarizer/concat.rb', line 30 def finalize(memo) [:before].to_s + memo + [:after].to_s end |
#least ⇒ Object
Returns least value (defaults to “”)
19 20 21 |
# File 'lib/bmg/summarizer/concat.rb', line 19 def least() "" end |