Sha256: 9d6e1e94bb8aea08f79c88cb6ad0b55a6772726b05c81ec0bb8a4504db41a59c

Contents?: true

Size: 334 Bytes

Versions: 20

Compression:

Stored size: 334 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

20 entries across 20 versions & 5 rubygems

Version Path
ar-octopus-ruby-3-0.11.3 spec/support/query_count.rb
ar-octopus-ruby-3-0.11.2 spec/support/query_count.rb
octoball-0.1.4 spec/support/query_count.rb
octoball-0.1.3 spec/support/query_count.rb
octoball-0.1.2 spec/support/query_count.rb
octoball-0.1.1 spec/support/query_count.rb
octoball-0.1.0 spec/support/query_count.rb
ar-octopus-0.10.2 spec/support/query_count.rb
ar-octopus-0.10.1 spec/support/query_count.rb
ar-octopus-0.10.0 spec/support/query_count.rb
ar-octopus-master-0.9.2.1 spec/support/query_count.rb
ar-octopus-0.9.2 spec/support/query_count.rb
ar-octopus-0.9.1 spec/support/query_count.rb
ar-octopus-0.9.0 spec/support/query_count.rb
ar-octopus-0.8.6 spec/support/query_count.rb
misha-ar-octopus-0.8.7 spec/support/query_count.rb
misha-ar-octopus-0.8.5 spec/support/query_count.rb
ar-octopus-0.8.5 spec/support/query_count.rb
ar-octopus-0.8.4 spec/support/query_count.rb
ar-octopus-0.8.3 spec/support/query_count.rb