activerecord-hierarchical_query 1.2.3 → 1.3.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: '08cdf36d6fb182dd4b149bfd278ce346b775f707b81759801cd29b2e2e413eb3'
4
- data.tar.gz: 05a716bc7921c28157eef8ea8f894a0b27fdfb84275c755ac7e3e5637c6e8dd0
3
+ metadata.gz: b5166c41ef62af29c1883f5b6e3f3447ba422bf76bae1bf5672f1f4991bbda08
4
+ data.tar.gz: 519b6c33c67c1b3e69578ca7abf693f1076a69f9d7f45cec5b800b954f17c7a2
5
5
  SHA512:
6
- metadata.gz: 714bdb7948f223ccfdb8f3a7c7b8188bd8b972a2c63bdbe35c0a5857970d806b3876e7ea7a539b7790866ca5e8e985d20080cff7162a6e927b2ebaa1b274bd3a
7
- data.tar.gz: 281f8ec47b4bbeec77ea2931130a1707997cd3f190b0242e63c6ef7d5096d6e1f4d9df6590beff9b9a029741a3d4e55ede05dcc6535bd80dc0c30406dd077676
6
+ metadata.gz: 21208d283a34594e442d19023db12e2d8cf3f79b04a55c397ce1dd97b5ccc6990db05a799b1a71a85410d5c2a905b7ba5e3791cbcb83e34611d138afe8c044d9
7
+ data.tar.gz: e54b02481e06962334aa9627c1fa1971dd92960aa5d2247dd4172a82f59738bcb5d10cafbc65efe8e8dcf373d81da7e4544e3fc0c938937fd33e343f7e672cd7
@@ -1,5 +1,3 @@
1
- require 'arel/visitors/depth_first'
2
-
3
1
  module ActiveRecord
4
2
  module HierarchicalQuery
5
3
  module CTE
@@ -18,7 +16,23 @@ module ActiveRecord
18
16
 
19
17
  private
20
18
  def connect_by_columns
21
- @query.join_conditions.grep(Arel::Attributes::Attribute) { |column| column.name.to_s }
19
+ columns = []
20
+ traverse(@query.join_conditions) do |node|
21
+ columns << node.name.to_s if node.is_a?(Arel::Attributes::Attribute)
22
+ end
23
+ columns
24
+ end
25
+
26
+ def traverse(ast, &blck)
27
+ if ast && ast.respond_to?(:left) && ast.left
28
+ traverse(ast.left, &blck)
29
+ end
30
+
31
+ if ast && ast.respond_to?(:right) && ast.right
32
+ traverse(ast.right, &blck)
33
+ end
34
+
35
+ yield ast
22
36
  end
23
37
  end
24
38
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module HierarchicalQuery
3
- VERSION = '1.2.3'
3
+ VERSION = '1.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-hierarchical_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexei Mikhailov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-03 00:00:00.000000000 Z
12
+ date: 2021-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: '5.0'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '6.1'
23
+ version: '6.2'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  version: '5.0'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '6.1'
33
+ version: '6.2'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: pg
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -55,14 +55,14 @@ dependencies:
55
55
  name: bundler
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - "~>"
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '1.16'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - "~>"
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: '1.16'
68
68
  - !ruby/object:Gem::Dependency
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 3.0.6
172
+ rubygems_version: 3.2.15
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: Recursively traverse trees using a single SQL query