syntax_tree_ext 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/syntax_tree_ext/version.rb +1 -1
- data/lib/syntax_tree_ext.rb +16 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05a2cd50808bce4efb80d3b03782548221a82ce170ad4c4c76384e237782e5fe
|
4
|
+
data.tar.gz: a9c7e46b6173218bc4034912bceb4ac51c475d32eed8cf780890bf6cda457fed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c0dccd7b1d3ec301be8597a8a2ee1d560079c095446b5a7bfbcc593e459dc727f6e8e84b2d8020d038821468b45a65d87de35a5a10fc8ae6be426288c07eef1
|
7
|
+
data.tar.gz: '0586df50645994c34790843e412fd65986fbf039c87c6601a49dcd38195ba79bf9b532eb925cf1e78db0fbd28a787e7b77d19726fa938e0233424e6aae76ba32'
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/syntax_tree_ext.rb
CHANGED
@@ -25,7 +25,16 @@ module SyntaxTree
|
|
25
25
|
|
26
26
|
def set_parent_node_and_source(source)
|
27
27
|
self.source = source
|
28
|
-
self.deconstruct_keys([]).except(:location, :comments).values.
|
28
|
+
self.deconstruct_keys([]).except(:location, :comments).values.each do |child_node|
|
29
|
+
if child_node.is_a?(Array)
|
30
|
+
child_node.each do |child_child_node|
|
31
|
+
next unless child_child_node.is_a?(Node)
|
32
|
+
|
33
|
+
child_child_node.parent_node = self
|
34
|
+
child_child_node.set_parent_node_and_source(source)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
29
38
|
next unless child_node.is_a?(Node)
|
30
39
|
|
31
40
|
child_node.parent_node = self
|
@@ -34,7 +43,12 @@ module SyntaxTree
|
|
34
43
|
end
|
35
44
|
|
36
45
|
def siblings
|
37
|
-
child_nodes = parent_node.deconstruct_keys([]).except(:location, :comments).values
|
46
|
+
child_nodes = parent_node.deconstruct_keys([]).except(:location, :comments).values
|
47
|
+
if child_nodes.is_a?(Array) && child_nodes.size == 1 && child_nodes.first.is_a?(Array)
|
48
|
+
index = child_nodes.first.index(self)
|
49
|
+
return child_nodes.first[index + 1...]
|
50
|
+
end
|
51
|
+
|
38
52
|
index = child_nodes.index(self)
|
39
53
|
child_nodes[index + 1...]
|
40
54
|
end
|