Sha256: 2fff2b8039c10df7105f9204d79936d4c7dd29995e486af3129a26193d337366

Contents?: true

Size: 420 Bytes

Versions: 2

Compression:

Stored size: 420 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.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.9 lib/active_reporter/serializer/nested_hash.rb
active_reporter-0.5.8 lib/active_reporter/serializer/nested_hash.rb