class Bmg::Summarizer::ByProc
Generic summarizer that takes a Proc àla each_with_object.
Example:
# direct ruby usage Bmg::Summarizer.by_proc{|t,memo| ... }.summarize(...)
Public Class Methods
new(least, by_proc)
click to toggle source
# File lib/bmg/summarizer/by_proc.rb, line 13 def initialize(least, by_proc) @least = least @by_proc = by_proc end
Public Instance Methods
finalize(memo)
click to toggle source
# File lib/bmg/summarizer/by_proc.rb, line 28 def finalize(memo) memo end
happens(memo, val)
click to toggle source
Adds val to the memo array
# File lib/bmg/summarizer/by_proc.rb, line 24 def happens(memo, val) @by_proc.call(val, memo) end
least()
click to toggle source
Returns [] as least value.
# File lib/bmg/summarizer/by_proc.rb, line 19 def least @least end