node_mutation 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +3 -2
- data/lib/node_mutation/parser_adapter.rb +4 -2
- data/lib/node_mutation/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: ff377f6938abd45d3c9de294e7f2aa495733ff48f95a36939bf38bae63f84e90
|
|
4
|
+
data.tar.gz: a4981d65f8b36882e5b9cf105a89798f14bf591716bb66cc0b8a2e0d029f9339
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1987c04293979252253faa150cef7309f31fe3b66abb6f2c17274f9eb1b486025f2be36867dfa6fc665a90ac84555b8234318be44165f798388f6b88e4d8c952
|
|
7
|
+
data.tar.gz: 30c8ac0e01b00390a959728ff82e6a4d3d263b1e46b56c111e600a40ebaab883b09652ff74f60636fecd6371d5dab6d31e32bdff335c353339c469c72fd67618
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# NodeMutation
|
|
2
2
|
|
|
3
|
+
## 1.8.0 (2022-12-26)
|
|
4
|
+
|
|
5
|
+
* `child_node_range` index starts from `0`
|
|
6
|
+
|
|
7
|
+
## 1.7.1 (2022-10-26)
|
|
8
|
+
|
|
9
|
+
* Return empty string for `NilClass` in `ParserAdapter#rewritten_source`
|
|
10
|
+
|
|
3
11
|
## 1.7.0 (2022-10-25)
|
|
4
12
|
|
|
5
13
|
* Add a new strategy `ALLOW_INSERT_AT_SAME_POSITION`
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
node_mutation (1.
|
|
4
|
+
node_mutation (1.8.0)
|
|
5
5
|
activesupport (< 7.0.0)
|
|
6
6
|
erubis
|
|
7
7
|
|
|
@@ -75,10 +75,11 @@ GEM
|
|
|
75
75
|
thor (1.2.1)
|
|
76
76
|
tzinfo (2.0.5)
|
|
77
77
|
concurrent-ruby (~> 1.0)
|
|
78
|
-
zeitwerk (2.6.
|
|
78
|
+
zeitwerk (2.6.6)
|
|
79
79
|
|
|
80
80
|
PLATFORMS
|
|
81
81
|
x86_64-darwin-21
|
|
82
|
+
x86_64-darwin-22
|
|
82
83
|
x86_64-linux
|
|
83
84
|
|
|
84
85
|
DEPENDENCIES
|
|
@@ -41,6 +41,8 @@ class NodeMutation::ParserAdapter < NodeMutation::Adapter
|
|
|
41
41
|
end
|
|
42
42
|
when String, Symbol, Integer, Float
|
|
43
43
|
evaluated
|
|
44
|
+
when NilClass
|
|
45
|
+
''
|
|
44
46
|
else
|
|
45
47
|
raise "can not parse \"#{code}\""
|
|
46
48
|
end
|
|
@@ -58,8 +60,8 @@ class NodeMutation::ParserAdapter < NodeMutation::Adapter
|
|
|
58
60
|
direct_child_name, nested_child_name = child_name.to_s.split('.', 2)
|
|
59
61
|
|
|
60
62
|
if node.is_a?(Array)
|
|
61
|
-
if direct_child_name =~ /\A
|
|
62
|
-
child_node = node[direct_child_name.to_i
|
|
63
|
+
if direct_child_name =~ /\A-?\d+\z/
|
|
64
|
+
child_node = node[direct_child_name.to_i]
|
|
63
65
|
raise NodeMutation::MethodNotSupported, "#{direct_child_name} is not supported for #{get_source(node)}" unless child_node
|
|
64
66
|
return child_node_range(child_node, nested_child_name) if nested_child_name
|
|
65
67
|
return OpenStruct.new(start: child_node.loc.expression.begin_pos, end: child_node.loc.expression.end_pos)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: node_mutation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Richard Huang
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-12-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
97
|
version: '0'
|
|
98
98
|
requirements: []
|
|
99
|
-
rubygems_version: 3.3.
|
|
99
|
+
rubygems_version: 3.3.26
|
|
100
100
|
signing_key:
|
|
101
101
|
specification_version: 4
|
|
102
102
|
summary: ast node mutation apis
|