Sha256: 10dc6808aee2508bf7cb0409812636149ef884168cbd10bcec77c2be95896d1d

Contents?: true

Size: 424 Bytes

Versions: 2

Compression:

Stored size: 424 Bytes

Contents

module ActiveReporter
  module Serializer
    class NestedHash < Base
      def table
        report.hashed_data.collect { |row| row.map { |k,v| [k, (v.respond_to?(:min) ? v.min : v).to_s] }.to_h }.collect do |row|
          report.grouper_names.reverse.inject(row.slice(*report.all_aggregators.keys)) { |nested_row_data, group| { row[group] => nested_row_data } }
        end.reduce({}, :merge)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_reporter-0.5.11 lib/active_reporter/serializer/nested_hash.rb
active_reporter-0.5.10 lib/active_reporter/serializer/nested_hash.rb