query_guard 0.3.0 → 0.4.0

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: 6bfc3581737fdfb115f1f3d59eaa678f061af78c561e0a03782eb019a46d4b3f
4
- data.tar.gz: dc3e1b303ca6044f7e18af3fc2dbbd309f2bd4e1c7aa4c0751cedc89a08dc2c1
3
+ metadata.gz: c9f5db2a91b0ae200669351d71161970cbccaa4da494081abb2371ba08356868
4
+ data.tar.gz: 9bf75098d98f45ad8e9669eee937cf4516fb6508d706a4dafcfcb33951b4af04
5
5
  SHA512:
6
- metadata.gz: 9bee2280297b23e229235ba461ec6c2c978a927e7dbb8f3c26270def1a5615b229948b50c483f2f9ac4c08c8546d96af1e355f8ae41acb032b52acaff7ef98c9
7
- data.tar.gz: ddd6d8b867f91afbe91e941864e0d2a656c3442aed5d7a579702e969358e52b9a38d9667956d3640e57593a9f45dd16406892ceac19f1938f96c6bfe787ce6bf
6
+ metadata.gz: bc20bd6bce97cbe713c8cfb76622739be00c2d1e79dde3b0823c721558a15cf34ea74ee02d113db13cdf92a1619df4ab2e24b76c2a3477fe99369902a13b0b39
7
+ data.tar.gz: 3fbd1f63298255c18b952b71964a7e664196e6988cf5cc3f6f22541983b2e6c7e51341d41957fb2cad72d488da0fc6d27ecdbe17940dc8f16082bbe5981e1a27
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module QueryGuard
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/query_guard.rb CHANGED
@@ -7,42 +7,32 @@ require "query_guard/subscriber"
7
7
  require "query_guard/middleware"
8
8
 
9
9
  module QueryGuard
10
- class << self
11
- attr_accessor :client, :config
10
+ mattr_accessor :config, default: Config.new
11
+ mattr_accessor :client
12
12
 
13
- def config
14
- @config ||= Config.new
15
- end
16
-
17
- def configure
18
- yield config
19
- self
20
- end
21
-
22
- def configure
23
- config ||= Config.new
24
- yield(config)
25
- client = Client.new(
26
- base_url: config.base_url,
27
- api_key: config.api_key,
28
- project: config.project,
29
- env: config.env
30
- )
31
- end
13
+ def self.configure
14
+ yield(config)
15
+ self.client = Client.new(
16
+ base_url: config.base_url,
17
+ api_key: config.api_key,
18
+ project: config.project,
19
+ env: config.env
20
+ )
21
+ self
22
+ end
32
23
 
33
- def install!(app = nil)
34
- # Install SQL subscriber once
35
- Subscriber.install!(config)
24
+ def self.install!(app = nil)
25
+ # Install SQL subscriber once
26
+ Subscriber.install!(config)
36
27
 
37
- # Install middleware (Rails or Rack)
38
- if defined?(Rails) && Rails.respond_to?(:application) && Rails.application
39
- # Use a Railtie-less insert for safety if called early
40
- Rails.application.config.middleware.use(QueryGuard::Middleware, config)
41
- elsif app
42
- app.use(QueryGuard::Middleware, config)
43
- end
44
- self
28
+ # Install middleware (Rails or Rack)
29
+ if defined?(Rails) && Rails.respond_to?(:application) && Rails.application
30
+ # Use a Railtie-less insert for safety if called early
31
+ Rails.application.config.middleware.use(QueryGuard::Middleware, config)
32
+ elsif app
33
+ app.use(QueryGuard::Middleware, config)
45
34
  end
35
+ self
46
36
  end
47
37
  end
48
38
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_guard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chitradevi36