node_query 1.13.2 → 1.13.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/lib/node_query/adapter/syntax_tree.rb +9 -1
- data/lib/node_query/helper.rb +5 -0
- data/lib/node_query/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7628f82cb6b224f6b9b0db0eb8bf6af8b2f86db79ced62c0ee335ab8b3c4b556
|
4
|
+
data.tar.gz: 7d68bf360a86a0597a337fd2db61a22468674d005a2b7055e48d3ab1b433fe3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 451f69a9540b987af3f615bba14ca332777a5371fbe9ae168cb14e7ce08d5013ba72197ea4b6deba684182900a2e0ecefe9178da19069af5d10e1c786aad90ef
|
7
|
+
data.tar.gz: 3b3dcdf5ca312edd305f0991bb861eb103b7da41bf6bc0b4f412f8775c4bef65014075def561ed4ac4efc50a6edc6f8ade598e90c7db9b64c07802643cc884f9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.13.4 (2023-06-15)
|
4
|
+
|
5
|
+
* Support `Hash#except` for ruby 2
|
6
|
+
|
7
|
+
## 1.13.3 (2023-06-14)
|
8
|
+
|
9
|
+
* Use `deconstruct_key` to get syntax_tree node children
|
10
|
+
* `handle_recursive_child` handles Array child node
|
11
|
+
|
3
12
|
## 1.13.2 (2023-05-18)
|
4
13
|
|
5
14
|
* Replace `Parser` specific code
|
data/Gemfile.lock
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
require 'syntax_tree'
|
4
4
|
require 'syntax_tree_ext'
|
5
5
|
|
6
|
+
if RUBY_VERSION.to_i < 3
|
7
|
+
class Hash
|
8
|
+
def except(*keys)
|
9
|
+
self.reject { |k, _| keys.include?(k) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
6
14
|
class NodeQuery::SyntaxTreeAdapter
|
7
15
|
def is_node?(node)
|
8
16
|
node.is_a?(SyntaxTree::Node)
|
@@ -17,7 +25,7 @@ class NodeQuery::SyntaxTreeAdapter
|
|
17
25
|
end
|
18
26
|
|
19
27
|
def get_children(node)
|
20
|
-
node.
|
28
|
+
node.deconstruct_keys([]).except(:location, :comments).values
|
21
29
|
end
|
22
30
|
|
23
31
|
def get_siblings(node)
|
data/lib/node_query/helper.rb
CHANGED
@@ -36,6 +36,11 @@ class NodeQuery::Helper
|
|
36
36
|
if NodeQuery.adapter.is_node?(child)
|
37
37
|
block.call(child)
|
38
38
|
handle_recursive_child(child, &block)
|
39
|
+
elsif child.is_a?(Array)
|
40
|
+
child.each do |child_child|
|
41
|
+
block.call(child_child)
|
42
|
+
handle_recursive_child(child_child, &block)
|
43
|
+
end
|
39
44
|
end
|
40
45
|
end
|
41
46
|
end
|
data/lib/node_query/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: node_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.13.
|
4
|
+
version: 1.13.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ast node query language
|
14
14
|
email:
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
|
-
rubygems_version: 3.4.
|
81
|
+
rubygems_version: 3.4.13
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: ast node query language
|