active_record_query_counter 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00cf8b2bba420e0b37944a53f4be128aeac846d6e387b15b03c3393f3a0030c2
4
- data.tar.gz: 10c05613e25513f1afab756f9cdd1133a19f7b54e34ca811b7f3ba5ad982ff0e
3
+ metadata.gz: 752c1c799ab4ee023a24f4f8c3550da35831fdcebf39e71c9bb945bbf4ca7ff9
4
+ data.tar.gz: ecd642c76f010996f40d0a6d791db96c06515137b2e1393d5655c1feae314b23
5
5
  SHA512:
6
- metadata.gz: 4294aac8c3b0b55197ba1d069cc0a57f269ad772c23480b928fcf3f0a01b7c4f806f4969bf32f2d229b8dea65bc976d18cc864f923ec468dbbb43fc2fbe20bdd
7
- data.tar.gz: ffddf3b2d87b74a2ad184d0ec55c4b371cda418c262aa2d0889cf40916579f5bff575ef0e631a39764edd58f7d321b71fa1b993dda6c3ff0c9f1ef060ca02769
6
+ metadata.gz: b4a88b4283290565e8352d35f6c0b5483515dbcacbd17fb223fc90398b94d50ac2984519f84c6a188a576468cb1f9ea373edfcc6855301e78522676558511e9d
7
+ data.tar.gz: ff360b2f495c953f79668a27520722c425c94d9cafe6607dcae40d25b65d10dd8f38f7b0d478771495927a5229ecf1e6948328b6adb87be5d6d186c77727d4f2
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 2.2.1
8
+
9
+ ### Changed
10
+
11
+ - Classes not required to run the gem are now lazy loaded.
12
+
7
13
  ## 2.2.0
8
14
 
9
15
  ### Added
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # ActiveRecordQueryCounter
2
2
 
3
- ![Continuous Integration](https://github.com/bdurand/active_record_query_counter/workflows/Continuous%20Integration/badge.svg)
3
+ [![Continuous Integration](https://github.com/bdurand/active_record_query_counter/actions/workflows/continuous_integration.yml/badge.svg)](https://github.com/bdurand/active_record_query_counter/actions/workflows/continuous_integration.yml)
4
+ [![Regression Test](https://github.com/bdurand/active_record_query_counter/actions/workflows/regression_test.yml/badge.svg)](https://github.com/bdurand/active_record_query_counter/actions/workflows/regression_test.yml)
4
5
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
6
+ [![Gem Version](https://badge.fury.io/rb/active_record_query_counter.svg)](https://badge.fury.io/rb/active_record_query_counter)
5
7
 
6
8
  This gem injects itself into ActiveRecord to give you insight into how your code is using the database.
7
9
 
@@ -204,6 +206,24 @@ ActiveSupport::Notifications.subscribe('active_record_query_counter.transaction_
204
206
  end
205
207
  ```
206
208
 
209
+ ## Installation
210
+
211
+ Add this line to your application's Gemfile:
212
+
213
+ ```ruby
214
+ gem 'active_record_query_counter'
215
+ ```
216
+
217
+ And then execute:
218
+ ```bash
219
+ $ bundle
220
+ ```
221
+
222
+ Or install it yourself as:
223
+ ```bash
224
+ $ gem install active_record_query_counter
225
+ ```
226
+
207
227
  ## Contributing
208
228
 
209
229
  Open a pull request on GitHub.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.0
1
+ 2.2.1
@@ -34,7 +34,7 @@ module ActiveRecordQueryCounter
34
34
  values.each do |key, value|
35
35
  setter = "#{key}="
36
36
  if respond_to?(setter)
37
- public_send("#{key}=", value)
37
+ public_send(:"#{key}=", value)
38
38
  else
39
39
  raise ArgumentError, "Unknown threshold: #{key}"
40
40
  end
@@ -2,12 +2,9 @@
2
2
 
3
3
  require_relative "active_record_query_counter/connection_adapter_extension"
4
4
  require_relative "active_record_query_counter/counter"
5
- require_relative "active_record_query_counter/rack_middleware"
6
- require_relative "active_record_query_counter/sidekiq_middleware"
7
5
  require_relative "active_record_query_counter/thresholds"
8
6
  require_relative "active_record_query_counter/transaction_info"
9
7
  require_relative "active_record_query_counter/transaction_manager_extension"
10
- require_relative "active_record_query_counter/version"
11
8
 
12
9
  # Everything you need to count ActiveRecord queries and row counts within a block.
13
10
  #
@@ -19,6 +16,10 @@ require_relative "active_record_query_counter/version"
19
16
  # puts ActiveRecordQueryCounter.row_count
20
17
  # end
21
18
  module ActiveRecordQueryCounter
19
+ autoload :RackMiddleware, "active_record_query_counter/rack_middleware"
20
+ autoload :SidekiqMiddleware, "active_record_query_counter/sidekiq_middleware"
21
+ autoload :VERSION, "active_record_query_counter/version"
22
+
22
23
  IGNORED_STATEMENTS = %w[SCHEMA EXPLAIN].freeze
23
24
  private_constant :IGNORED_STATEMENTS
24
25
 
@@ -233,8 +234,10 @@ module ActiveRecordQueryCounter
233
234
  # @param connection_class [Class] the connection adapter class to extend
234
235
  # @return [void]
235
236
  def enable!(connection_class)
236
- ConnectionAdapterExtension.inject(connection_class)
237
- TransactionManagerExtension.inject(ActiveRecord::ConnectionAdapters::TransactionManager)
237
+ ActiveSupport.on_load(:active_record) do
238
+ ConnectionAdapterExtension.inject(connection_class)
239
+ TransactionManagerExtension.inject(ActiveRecord::ConnectionAdapters::TransactionManager)
240
+ end
238
241
 
239
242
  @cache_subscription ||= ActiveSupport::Notifications.subscribe("sql.active_record") do |_name, _start_time, _end_time, _id, payload|
240
243
  if payload[:cached]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_query_counter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-03 00:00:00.000000000 Z
11
+ date: 2024-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -46,7 +46,7 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - CHANGELOG.md
49
- - MIT_LICENSE
49
+ - MIT_LICENSE.txt
50
50
  - README.md
51
51
  - VERSION
52
52
  - active_record_query_counter.gemspec
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  requirements: []
81
- rubygems_version: 3.4.20
81
+ rubygems_version: 3.4.12
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: Count total number of ActiveRecord queries and row counts inside a block
File without changes