Sha256: 3161ee2dda831ae7b17f6ae1d2ba952c9abcb0b50e9b38798a585742265899ee

Contents?: true

Size: 332 Bytes

Versions: 4

Compression:

Stored size: 332 Bytes

Contents

module ActiveRecord
  class QueryCounter

    attr_accessor :query_count

    def initialize
      @query_count = 0
    end

    def to_proc
      lambda(&method(:callback))
    end

    def callback(name, start, finish, message_id, values)
      @query_count += 1 unless %w(CACHE SCHEMA).include?(values[:name])
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ar-octopus-0.8.2 spec/support/query_count.rb
ar-octopus-0.8.1 spec/support/query_count.rb
ar-octopus-0.8.0 spec/support/query_count.rb
ar-octopus-0.7.0 spec/support/query_count.rb