Class: Rack::AllocationStats::Formatters::JSON

Inherits:
Base
  • Object
show all
Defined in:
lib/rack/allocation_stats/formatters/json.rb

Overview

Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0, found in the LICENSE file.

Instance Method Summary collapse

Instance Method Details

#formatObject



5
6
7
8
9
10
11
# File 'lib/rack/allocation_stats/formatters/json.rb', line 5

def format
  allocations = @allocations.to_a.map do |group_key, allocations|
    { group_key: group_key, allocations: allocations }
  end

  return [Yajl::Encoder.encode(allocations)]
end