table_saw 2.3.0 → 2.4.0

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: 858ba4566ea024a132f1f674faaabecafd97938d930329f552a2bd86530e46c7
4
- data.tar.gz: 5cada2de36a7790563ec3347a7af8b52d3e70722387b13258b11c78b33798015
3
+ metadata.gz: bfb7db9a15aed357484e10dabd9687a4b06fa2f8871bbff409c2dd54e7172cb3
4
+ data.tar.gz: ae37d05b97291739a83964d6e7b2c741cafbf7579087bb5c9e5721c0f08efd78
5
5
  SHA512:
6
- metadata.gz: '036185f2584a299a98439068e1cef0dcbd5229b0fb81768029e92beb3f4e724865379dea00a84a169eeedddcbf99262ef7bb1fafaf0646310f8424669a79a4bd'
7
- data.tar.gz: db613c022e74e739c9109b3c5d25ba3e12682083446df5aac6c84cdf2f4216298e55edbd618e95b5c541c614a558497a09433af6afe4db87f632d5ea5c374241
6
+ metadata.gz: 60c64ddc7485a42fd359de58e6c0cbcaff2a05747ad03998e7ee9774e28d02864025a99f4513f8f63320364a8b00034771c4b946ce776f07e66ebd3dd232d2a3
7
+ data.tar.gz: 2b754503fa0039d4192e73c006e5fac4abde173dc26b2625242260f54e215e57f31f2a3ca9455e35bbd743b5b051b7ba6e68987fec9e06aa1a37a0b52136a469
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- table_saw (2.3.0)
4
+ table_saw (2.4.0)
5
5
  activerecord (>= 5.2)
6
6
  pg
7
7
  thor
@@ -9,35 +9,34 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (5.2.3)
13
- actionview (= 5.2.3)
14
- activesupport (= 5.2.3)
12
+ actionpack (6.0.1)
13
+ actionview (= 6.0.1)
14
+ activesupport (= 6.0.1)
15
15
  rack (~> 2.0)
16
16
  rack-test (>= 0.6.3)
17
17
  rails-dom-testing (~> 2.0)
18
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
19
- actionview (5.2.3)
20
- activesupport (= 5.2.3)
18
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
+ actionview (6.0.1)
20
+ activesupport (= 6.0.1)
21
21
  builder (~> 3.1)
22
22
  erubi (~> 1.4)
23
23
  rails-dom-testing (~> 2.0)
24
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
25
- activemodel (5.2.3)
26
- activesupport (= 5.2.3)
27
- activerecord (5.2.3)
28
- activemodel (= 5.2.3)
29
- activesupport (= 5.2.3)
30
- arel (>= 9.0)
31
- activesupport (5.2.3)
24
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
+ activemodel (6.0.1)
26
+ activesupport (= 6.0.1)
27
+ activerecord (6.0.1)
28
+ activemodel (= 6.0.1)
29
+ activesupport (= 6.0.1)
30
+ activesupport (6.0.1)
32
31
  concurrent-ruby (~> 1.0, >= 1.0.2)
33
32
  i18n (>= 0.7, < 2)
34
33
  minitest (~> 5.1)
35
34
  tzinfo (~> 1.1)
36
- arel (9.0.0)
35
+ zeitwerk (~> 2.2)
37
36
  ast (2.4.0)
38
37
  builder (3.2.3)
39
38
  coderay (1.1.2)
40
- combustion (1.1.0)
39
+ combustion (1.1.2)
41
40
  activesupport (>= 3.0.0)
42
41
  railties (>= 3.0.0)
43
42
  thor (>= 0.14.6)
@@ -46,18 +45,18 @@ GEM
46
45
  database_cleaner (1.7.0)
47
46
  diff-lcs (1.3)
48
47
  docile (1.3.1)
49
- erubi (1.8.0)
48
+ erubi (1.9.0)
50
49
  i18n (1.7.0)
51
50
  concurrent-ruby (~> 1.0)
52
51
  jaro_winkler (1.5.2)
53
52
  json (2.2.0)
54
- loofah (2.3.1)
53
+ loofah (2.4.0)
55
54
  crass (~> 1.0.2)
56
55
  nokogiri (>= 1.5.9)
57
56
  method_source (0.9.2)
58
57
  mini_portile2 (2.4.0)
59
58
  minitest (5.13.0)
60
- nokogiri (1.10.5)
59
+ nokogiri (1.10.7)
61
60
  mini_portile2 (~> 2.4.0)
62
61
  parallel (1.17.0)
63
62
  parser (2.6.3.0)
@@ -72,14 +71,14 @@ GEM
72
71
  rails-dom-testing (2.0.3)
73
72
  activesupport (>= 4.2.0)
74
73
  nokogiri (>= 1.6)
75
- rails-html-sanitizer (1.0.4)
76
- loofah (~> 2.2, >= 2.2.2)
77
- railties (5.2.3)
78
- actionpack (= 5.2.3)
79
- activesupport (= 5.2.3)
74
+ rails-html-sanitizer (1.3.0)
75
+ loofah (~> 2.3)
76
+ railties (6.0.1)
77
+ actionpack (= 6.0.1)
78
+ activesupport (= 6.0.1)
80
79
  method_source
81
80
  rake (>= 0.8.7)
82
- thor (>= 0.19.0, < 2.0)
81
+ thor (>= 0.20.3, < 2.0)
83
82
  rainbow (3.0.0)
84
83
  rake (10.5.0)
85
84
  rspec (3.8.0)
@@ -113,11 +112,12 @@ GEM
113
112
  json (>= 1.8, < 3)
114
113
  simplecov-html (~> 0.10.0)
115
114
  simplecov-html (0.10.2)
116
- thor (0.19.4)
115
+ thor (0.20.3)
117
116
  thread_safe (0.3.6)
118
117
  tzinfo (1.2.5)
119
118
  thread_safe (~> 0.1)
120
119
  unicode-display_width (1.6.0)
120
+ zeitwerk (2.2.2)
121
121
 
122
122
  PLATFORMS
123
123
  ruby
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'pg'
4
3
  require 'active_record'
4
+
5
+ require 'active_record/connection_adapters/abstract/connection_pool'
5
6
  require 'active_record/connection_adapters/postgresql_adapter'
6
7
 
7
8
  module TableSaw
@@ -9,11 +10,7 @@ module TableSaw
9
10
  def self.with
10
11
  raise ArgumentError, 'requires a block' unless block_given?
11
12
 
12
- yield raw
13
- end
14
-
15
- def self.raw
16
- @raw ||= PG::Connection.new(TableSaw.configuration.connection)
13
+ yield adapter.raw_connection
17
14
  end
18
15
 
19
16
  def self.exec(sql)
@@ -23,8 +20,11 @@ module TableSaw
23
20
  end
24
21
 
25
22
  def self.adapter
26
- @adapter ||=
27
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new(nil, nil, TableSaw.configuration.connection, {})
23
+ @adapter ||= begin
24
+ config = TableSaw.configuration.connection
25
+ conn = ::PG::Connection.new(config)
26
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new(conn, nil, config, {})
27
+ end
28
28
  end
29
29
  end
30
30
  end
@@ -27,6 +27,7 @@ module TableSaw
27
27
  end
28
28
  end
29
29
 
30
+ # rubocop:disable Metrics/AbcSize
30
31
  def query_result(column)
31
32
  return [] unless directive.selectable?
32
33
 
@@ -34,10 +35,13 @@ module TableSaw
34
35
  format(
35
36
  'select distinct %{column} from %{table_name} where %{clause} and %{column} is not null',
36
37
  primary_key: directive.primary_key, column: column, table_name: directive.table_name,
37
- clause: TableSaw::Queries::SerializeSqlInClause.new(directive.table_name, column, directive.ids).call
38
+ clause: TableSaw::Queries::SerializeSqlInClause.new(directive.table_name,
39
+ directive.primary_key,
40
+ directive.ids).call
38
41
  )
39
42
  )
40
43
  end
44
+ # rubocop:enable Metrics/AbcSize
41
45
  end
42
46
  end
43
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TableSaw
4
- VERSION = '2.3.0'
4
+ VERSION = '2.4.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_saw
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamed Asghari