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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e788bebfcb80e34a61554c7a7b0ed608f08ab62859be1c3e104229c1641ca119
4
- data.tar.gz: f37569d6b395df1263253e90ae3a014c8d5f404141f6c097e54e427c6d9f53df
3
+ metadata.gz: 05a2cd50808bce4efb80d3b03782548221a82ce170ad4c4c76384e237782e5fe
4
+ data.tar.gz: a9c7e46b6173218bc4034912bceb4ac51c475d32eed8cf780890bf6cda457fed
5
5
  SHA512:
6
- metadata.gz: f9519fc61d292216b946f2df7abebb91d9d71b5201530fe96ac583f15df333e84f44fa9418b1013fa10b40914087c36065aca14e1cf73816f071d68e5e8120f1
7
- data.tar.gz: defd5612e73938662ff0272c3a2fb544dcb31eb29ae16e1a7b7f44f96f7d8d5ae253a7261734605f9ac12f5faa3d04f7a851fd53d7312fc1f4e843ce997b6fd0
6
+ metadata.gz: 2c0dccd7b1d3ec301be8597a8a2ee1d560079c095446b5a7bfbcc593e459dc727f6e8e84b2d8020d038821468b45a65d87de35a5a10fc8ae6be426288c07eef1
7
+ data.tar.gz: '0586df50645994c34790843e412fd65986fbf039c87c6601a49dcd38195ba79bf9b532eb925cf1e78db0fbd28a787e7b77d19726fa938e0233424e6aae76ba32'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.6.2 (2024-06-26)
4
+
5
+ * Do not flatten `deconstruct_keys`.`values`
6
+
3
7
  ## 0.6.1 (2024-06-26)
4
8
 
5
9
  * Use `deconstruct_key`.`values` instead of `child_nodes`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- syntax_tree_ext (0.6.1)
4
+ syntax_tree_ext (0.6.2)
5
5
  syntax_tree
6
6
 
7
7
  GEM
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SyntaxTreeExt
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.2"
5
5
  end
@@ -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.flatten.each do |child_node|
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.flatten
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syntax_tree_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang