simple-sql 0.5.20 → 0.5.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35d1b619f4df0cf9527247e4148c10c035bc6ce3fc3d8302d9d59f68aba13efe
4
- data.tar.gz: 945a6e98dc8057b9bbf222a149f6cda25105144d0e9815965c05e6b35423627a
3
+ metadata.gz: 96995841ebed4baaca67fa39701958d3ccff3a36325400075b043eb1d7236de5
4
+ data.tar.gz: fc6ae8d35382e6c6d0aead1743ade7add236cc9e40e50d8f896f353a8e804b3d
5
5
  SHA512:
6
- metadata.gz: 4a132b274a9ab9c10bebba9948d9611d9eba759ba3e492e40b94da391e136970039e3e88b495073e8da358d029c492a75b42128a8921894acd523362719b6d2d
7
- data.tar.gz: 938f7f09cd06b1f743434edd3f257b30142fc82b067badef3e7e79aea92da430e0074cb41df9364eb49c13c3d8e32fcbd87932ee4e621c0159bd969a1a74c772
6
+ metadata.gz: 5b22a609bcee2a0ad16d1026e586e4845757d63bef891cfa6f38f4ab6268bdf752a34cb5eb72b588e53ffd31c53080b922095e22a1b4556c0c1047fbd505265b
7
+ data.tar.gz: bf5dc5c752346705a75ab3274c96a4998012344af45400e76f2f00f5498ed676caa95ff70406654c3ce0d05cbeaabba3d4fd9350c1ee3a4c8bb256ba703e8bff
@@ -11,19 +11,21 @@ module Simple::SQL
11
11
  extend self
12
12
 
13
13
  def disconnect_all!
14
- ActiveRecord::Base.connection_pool.disconnect!
15
- connection_classes.values.map(&:connection_pool).each(&:disconnect!)
16
- connection_classes.clear
14
+ ActiveRecord::Base.connection_pool.disconnect! if ActiveRecord::Base.connected?
15
+
16
+ connection_classes = connection_class_by_url.values
17
+ connection_classes.select(&:connected?).map(&:connection_pool).each(&:disconnect!)
18
+ connection_class_by_url.clear
17
19
  end
18
20
 
19
21
  def connection_class(url)
20
- connection_classes[url] ||= create_connection_class(url)
22
+ connection_class_by_url[url] ||= create_connection_class(url)
21
23
  end
22
24
 
23
25
  private
24
26
 
25
- def connection_classes
26
- @connection_classes ||= {}
27
+ def connection_class_by_url
28
+ @connection_class_by_url ||= {}
27
29
  end
28
30
 
29
31
  # ActiveRecord needs a class name in order to connect.
@@ -1,5 +1,5 @@
1
1
  module Simple
2
2
  module SQL
3
- VERSION = "0.5.20"
3
+ VERSION = "0.5.21"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.20
4
+ version: 0.5.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-07-11 00:00:00.000000000 Z
12
+ date: 2019-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg_array_parser
@@ -269,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
269
  - !ruby/object:Gem::Version
270
270
  version: '0'
271
271
  requirements: []
272
- rubygems_version: 3.0.2
272
+ rubygems_version: 3.0.4
273
273
  signing_key:
274
274
  specification_version: 4
275
275
  summary: SQL with a simple interface