Class: Bmg::Summarizer::Concat

Inherits:
Bmg::Summarizer show all
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

#functor, #options

Instance Method Summary collapse

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 << options[:between].to_s unless memo.empty?
  memo << val.to_s
end

#default_optionsObject

Sets default options.



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

def default_options
  {:before => "", :after => "", :between => ""}
end

#finalize(memo) ⇒ Object

Finalizes computation



30
31
32
# File 'lib/bmg/summarizer/concat.rb', line 30

def finalize(memo)
  options[:before].to_s + memo + options[:after].to_s
end

#leastObject

Returns least value (defaults to “”)



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

def least()
  ""
end