Sha256: aa10c34aeb4caaf7336a1fadeb6355ac7370efb0a11f6cd0757829b1818f45b1

Contents?: true

Size: 393 Bytes

Versions: 8

Compression:

Stored size: 393 Bytes

Contents

# encoding: UTF-8

module MongoMapper
  module Plugins
    module Stats
      extend ActiveSupport::Concern
      module ClassMethods
        def stats
          stats = database.command(:collstats => collection.name).documents[0]
          Struct.new(*stats.keys.collect { |key| key.underscore.to_sym }).new(*stats.values)
        rescue
          nil
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mongo_mapper-0.16.0 lib/mongo_mapper/plugins/stats.rb
mongo_mapper-0.15.6 lib/mongo_mapper/plugins/stats.rb
mongo_mapper-0.15.5 lib/mongo_mapper/plugins/stats.rb
mongo_mapper-0.15.4 lib/mongo_mapper/plugins/stats.rb
mongo_mapper-0.15.3 lib/mongo_mapper/plugins/stats.rb
mongo_mapper-0.15.2 lib/mongo_mapper/plugins/stats.rb
mongo_mapper-0.15.1 lib/mongo_mapper/plugins/stats.rb
mongo_mapper-0.15.0 lib/mongo_mapper/plugins/stats.rb