class Bmg::DistinctList

Summarizes by putting distinct dependents inside an Array, ignoring nils, and optionally sorting the array.

Public Class Methods

new(&sorter) click to toggle source
# File lib/bmg/operator/autosummarize.rb, line 162
def initialize(&sorter)
  @sorter = sorter
end

Public Instance Methods

init(v) click to toggle source
# File lib/bmg/operator/autosummarize.rb, line 166
def init(v)
  Set.new v.nil? ? [] : [v]
end
inspect() click to toggle source
# File lib/bmg/operator/autosummarize.rb, line 181
def inspect
  ":group"
end
Also aliased as: to_s
sum(v1, v2) click to toggle source
# File lib/bmg/operator/autosummarize.rb, line 170
def sum(v1, v2)
  v1 << v2 unless v2.nil?
  v1
end
term(v) click to toggle source
# File lib/bmg/operator/autosummarize.rb, line 175
def term(v)
  v = v.to_a
  v = v.sort(&@sorter) if @sorter
  v
end
to_s()
Alias for: inspect