Sha256: 7c644f168accdd32e384415383cb8634ab705ffa291e08919954a764943f2d08

Contents?: true

Size: 406 Bytes

Versions: 1

Compression:

Stored size: 406 Bytes

Contents

module Rails
  module Internals
    class ObjectSpaceInfo
      attr_reader :counts

      def initialize
        @counts = ObjectSpace.count_objects
      end

      def total
        @counts[:TOTAL]
      end

      def ratios
        @rations ||= @counts.except(:TOTAL, :FREE).each_with_object({}) do |(key, value), hash|
          hash[key] = value / total.to_f
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-internals-0.1.0 app/models/rails/internals/object_space_info.rb