logical_query_parser 0.3.3 → 0.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: 633738053640edcf7db6ea3e81cb905145b8f7e40c11059971075c9cbb22c583
4
- data.tar.gz: b8831c8189ab803c5a8f64afdac792edf6e3ffbbd589dbf5625b095138650f1c
3
+ metadata.gz: 21e876f1e9e4496b81a09656f8f9667817b79cc961fd72557dafd56ee20f7f37
4
+ data.tar.gz: b44d2f653f33c10de26fa2f80010836291abe78804354b84bb9aa1c54f5210ac
5
5
  SHA512:
6
- metadata.gz: c3662633dc156b54e6af5db7a7744ea6c019f8bb4ef9558ab524349574c9a0888108c432e05e2ff13264ec5f0e32d44764a2e86155dd1ffe47d86212e351363f
7
- data.tar.gz: e5408c71d250dfdc3e9da7f2c7c28011fe149f850079cb878be9eb23a06fd858fc984cc5cd31954a7e2b3eac849456b107509da16ddb7b2bb620e8c74d1376eb
6
+ metadata.gz: 0b1337963075eb702293de0b3f9fb01880db2e2b7ed15b265858806fd5a75c25c0dd253c309060c7fa6982a8eda8e1b42d1ed82a3d978ac94a58f6169b9959e3
7
+ data.tar.gz: 02a3028859413314aee0284ac1beda1355dd633101ed449c2029447277a5e3c8fd552afc683313f276e8bdd25f9a868f6fc8b1cbd443603c9f6ce422947f3104
@@ -4,12 +4,12 @@ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  test:
7
- runs-on: ubuntu-20.04
7
+ runs-on: ubuntu-22.04
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2]
12
- gemfile: ['rails42', 'rails50', 'rails51', 'rails52', 'rails60', 'rails61', 'rails70']
11
+ ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3]
12
+ gemfile: ['rails42', 'rails50', 'rails51', 'rails52', 'rails60', 'rails61', 'rails70', 'rails71']
13
13
  exclude:
14
14
  - ruby: 2.3
15
15
  gemfile: rails60
@@ -17,16 +17,24 @@ jobs:
17
17
  gemfile: rails61
18
18
  - ruby: 2.3
19
19
  gemfile: rails70
20
+ - ruby: 2.3
21
+ gemfile: rails71
20
22
  - ruby: 2.4
21
23
  gemfile: rails60
22
24
  - ruby: 2.4
23
25
  gemfile: rails61
24
26
  - ruby: 2.4
25
27
  gemfile: rails70
28
+ - ruby: 2.4
29
+ gemfile: rails71
26
30
  - ruby: 2.5
27
31
  gemfile: rails70
32
+ - ruby: 2.5
33
+ gemfile: rails71
28
34
  - ruby: 2.6
29
35
  gemfile: rails70
36
+ - ruby: 2.6
37
+ gemfile: rails71
30
38
  - ruby: 2.7
31
39
  gemfile: rails42
32
40
  - ruby: 3.0
@@ -53,6 +61,14 @@ jobs:
53
61
  gemfile: rails51
54
62
  - ruby: 3.2
55
63
  gemfile: rails52
64
+ - ruby: 3.3
65
+ gemfile: rails42
66
+ - ruby: 3.3
67
+ gemfile: rails50
68
+ - ruby: 3.3
69
+ gemfile: rails51
70
+ - ruby: 3.3
71
+ gemfile: rails52
56
72
 
57
73
  name: ruby ${{ matrix.ruby }}, ${{ matrix.gemfile }}
58
74
 
@@ -60,7 +76,7 @@ jobs:
60
76
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
61
77
 
62
78
  steps:
63
- - uses: actions/checkout@v3
79
+ - uses: actions/checkout@v4
64
80
  - uses: ruby/setup-ruby@v1
65
81
  with:
66
82
  ruby-version: ${{ matrix.ruby }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.4.0
4
+
5
+ * Add `frozen_string_literal: true`.
6
+ * Fix internal hash key for building sql.
7
+
8
+ ## 0.3.4
9
+
10
+ * Just rebuild gem file to fix file permission.
11
+
3
12
  ## 0.3.3
4
13
 
5
14
  * Fix parsing literals which contains a logical operator. (#7 by scambra)
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem "activerecord", "~> 6.0.0"
4
+ gem "sqlite3", "~> 1.4.0"
4
5
  gem "psych", "~> 3.3.0"
5
6
 
6
7
  gemspec path: "../"
@@ -1,5 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem "rails", "~> 6.1.0"
4
+ gem "sqlite3", "~> 1.4.0"
4
5
 
5
6
  gemspec path: "../"
@@ -1,5 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem "rails", "~> 7.0.1"
4
+ gem "sqlite3", "~> 1.4.0"
4
5
 
5
6
  gemspec path: "../"
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails", "~> 7.1.0"
4
+ gem "sqlite3", "~> 1.6.6"
5
+
6
+ gemspec path: "../"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LogicalQueryParser
2
4
  class Assoc
3
5
  attr_accessor :column_mapping, :structure
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'assoc'
2
4
 
3
5
  module LogicalQueryParser
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LogicalQueryParser
2
4
  module ExpNode
3
5
  def to_sql(params = {})
4
- params[:sql] ||= ''
6
+ params[:_sql] ||= ''.dup
5
7
  exp.to_sql(params)
6
8
  end
7
9
  end
@@ -15,10 +17,10 @@ module LogicalQueryParser
15
17
  exp.to_sql(params)
16
18
  rparen.to_sql(params)
17
19
  if rexp.elements.size > 0
18
- params[:sql] += ' AND '
20
+ params[:_sql] += ' AND '
19
21
  rexp.elements[0].to_sql(params)
20
22
  end
21
- params[:sql]
23
+ params[:_sql]
22
24
  end
23
25
  end
24
26
 
@@ -33,38 +35,38 @@ module LogicalQueryParser
33
35
  module LiteralExpNode
34
36
  def to_sql(params)
35
37
  literal.to_sql(params)
36
- params[:sql] << ' AND '
38
+ params[:_sql] << ' AND '
37
39
  exp.to_sql(params)
38
40
  end
39
41
  end
40
42
 
41
43
  module LParenNode
42
44
  def to_sql(params)
43
- params[:sql] << '('
45
+ params[:_sql] << '('
44
46
  end
45
47
  end
46
48
 
47
49
  module RParenNode
48
50
  def to_sql(params)
49
- params[:sql] << ')'
51
+ params[:_sql] << ')'
50
52
  end
51
53
  end
52
54
 
53
55
  module AndNode
54
56
  def to_sql(params)
55
- params[:sql] << ' AND '
57
+ params[:_sql] << ' AND '
56
58
  end
57
59
  end
58
60
 
59
61
  module OrNode
60
62
  def to_sql(params)
61
- params[:sql] << ' OR '
63
+ params[:_sql] << ' OR '
62
64
  end
63
65
  end
64
66
 
65
67
  module NotNode
66
68
  def to_sql(params)
67
- params[:sql] << 'NOT '
69
+ params[:_sql] << 'NOT '
68
70
  end
69
71
  end
70
72
 
@@ -75,7 +77,7 @@ module LogicalQueryParser
75
77
 
76
78
  sql = build_arel(params, operator, text).reduce(logic).to_sql
77
79
  sql = "(#{sql})" if sql[0] != '(' && sql[-1] != ')'
78
- params[:sql] << sql
80
+ params[:_sql] << sql
79
81
  end
80
82
 
81
83
  private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LogicalQueryParser
2
4
  module ExpNode
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LogicalQueryParser
2
- VERSION = "0.3.3"
4
+ VERSION = "0.4.0"
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'treetop'
2
4
  Treetop.load File.expand_path("../logical_query_parser.treetop", __FILE__)
3
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logical_query_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshikazu Kaneta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-24 00:00:00.000000000 Z
11
+ date: 2024-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: treetop
@@ -134,6 +134,7 @@ files:
134
134
  - gemfiles/rails60.gemfile
135
135
  - gemfiles/rails61.gemfile
136
136
  - gemfiles/rails70.gemfile
137
+ - gemfiles/rails71.gemfile
137
138
  - lib/logical_query_parser.rb
138
139
  - lib/logical_query_parser.treetop
139
140
  - lib/logical_query_parser/assoc.rb