class AllocationStats::AllocationsProxy
def bytes
this transform maps each value in the Hash (which is an Array of
* If the current result set is a Hash (meaning it has been grouped), then
each Allocation to its `#memsize`.
* If the current result set is an Array, then this transform just maps
two ways:
Map to bytes via {Allocation#memsize #memsize}. This is done in one of
def bytes @mappers << Proc.new do |allocations| if allocations.is_a? Array allocations.map(&:memsize) elsif allocations.is_a? Hash bytes_h = {} allocations.each do |key, allocations| bytes_h[key] = allocations.inject(0) { |sum, allocation| sum + allocation.memsize } end bytes_h end end self end