Sha256: 69234ba7464b4a4bde1f2618b61c699bcab29e6f61f3fcebd51be3b6e7960cd1

Contents?: true

Size: 429 Bytes

Versions: 9

Compression:

Stored size: 429 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({}, :deep_merge)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
active_reporter-0.7.1 lib/active_reporter/serializer/nested_hash.rb
active_reporter-0.6.5 lib/active_reporter/serializer/nested_hash.rb
active_reporter-0.6.4 lib/active_reporter/serializer/nested_hash.rb
active_reporter-0.6.3 lib/active_reporter/serializer/nested_hash.rb
active_reporter-0.6.2 lib/active_reporter/serializer/nested_hash.rb
active_reporter-0.6.1 lib/active_reporter/serializer/nested_hash.rb
active_reporter-0.6.0 lib/active_reporter/serializer/nested_hash.rb
active_reporter-0.5.13 lib/active_reporter/serializer/nested_hash.rb
active_reporter-0.5.12 lib/active_reporter/serializer/nested_hash.rb