lib/data_table.rb
# aggregates a set of rows using aggregator functions
aggregates a set of rows using aggregator functions
aggregates a set of rows using aggregator functions
def aggregate(key, rows, aggregators, group_key)
    aggregated_row = Row.new(self)
    aggregated_row[key] = group_key.call(rows.first[key])
    aggregators.each do |key, aggregator|
      aggregated_row[key] = aggregator.call(key, rows)
    end
    aggregated_row
  end
def aggregate ( key , rows , aggregators , group_key ) aggregated_row = Row . new ( self ) aggregated_row [ key ] = group_key . call ( rows . first [ key ] ) aggregators . each do | key , aggregator | aggregated_row [ key ] = aggregator . call ( key , rows ) end aggregated_row end
aggregates a set of rows using aggregator functions
aggregates a set of rows using aggregator functions
key
<not_specific>
rows
<not_specific>
aggregators
<not_specific>
group_key
<not_specific>