node_mutation 1.8.0 → 1.8.2
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 +1 -15
- data/lib/node_mutation/parser_adapter.rb +5 -3
- data/lib/node_mutation/version.rb +1 -1
- data/lib/node_mutation.rb +0 -1
- data/node_mutation.gemspec +0 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be47289a83fa7295154056c8c6adc404f4f190d580a47dc78660dcfd082917d1
|
4
|
+
data.tar.gz: 15f40478c899eb9b4e8fd809edc4ebec139f8d85a98bd7573103fee2b62ebde6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25e98cb3610598d9a30de2f880c071a04020c4507c8700826aa047f48179b340ad0e8e258f2301738717c5a7dd809ed9b78d75f0f1b3f9b3f243371c3d132fa5
|
7
|
+
data.tar.gz: 0e615252351fa511f0e1be269c74fdd77bf1477ec97745bb5cfb747a9657356cdedde24357001fcfd4b879cb47b5daf603e7e3af0c82716156de1e531c68f2a3
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,22 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
node_mutation (1.8.
|
5
|
-
activesupport (< 7.0.0)
|
4
|
+
node_mutation (1.8.2)
|
6
5
|
erubis
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
10
9
|
specs:
|
11
|
-
activesupport (6.1.7)
|
12
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
-
i18n (>= 1.6, < 2)
|
14
|
-
minitest (>= 5.1)
|
15
|
-
tzinfo (~> 2.0)
|
16
|
-
zeitwerk (~> 2.3)
|
17
10
|
ast (2.4.2)
|
18
11
|
coderay (1.1.3)
|
19
|
-
concurrent-ruby (1.1.10)
|
20
12
|
diff-lcs (1.5.0)
|
21
13
|
erubis (2.7.0)
|
22
14
|
ffi (1.15.5)
|
@@ -35,14 +27,11 @@ GEM
|
|
35
27
|
guard (~> 2.1)
|
36
28
|
guard-compat (~> 1.1)
|
37
29
|
rspec (>= 2.99.0, < 4.0)
|
38
|
-
i18n (1.12.0)
|
39
|
-
concurrent-ruby (~> 1.0)
|
40
30
|
listen (3.7.1)
|
41
31
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
42
32
|
rb-inotify (~> 0.9, >= 0.9.10)
|
43
33
|
lumberjack (1.2.8)
|
44
34
|
method_source (1.0.0)
|
45
|
-
minitest (5.16.3)
|
46
35
|
nenv (0.3.0)
|
47
36
|
notiffany (0.1.3)
|
48
37
|
nenv (~> 0.1)
|
@@ -73,9 +62,6 @@ GEM
|
|
73
62
|
rspec-support (3.11.0)
|
74
63
|
shellany (0.0.1)
|
75
64
|
thor (1.2.1)
|
76
|
-
tzinfo (2.0.5)
|
77
|
-
concurrent-ruby (~> 1.0)
|
78
|
-
zeitwerk (2.6.6)
|
79
65
|
|
80
66
|
PLATFORMS
|
81
67
|
x86_64-darwin-21
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
INDEX_REGEXP = /\A-?\d+\z/
|
4
|
+
|
3
5
|
class NodeMutation::ParserAdapter < NodeMutation::Adapter
|
4
6
|
def get_source(node)
|
5
7
|
if node.is_a?(Array)
|
@@ -60,7 +62,7 @@ class NodeMutation::ParserAdapter < NodeMutation::Adapter
|
|
60
62
|
direct_child_name, nested_child_name = child_name.to_s.split('.', 2)
|
61
63
|
|
62
64
|
if node.is_a?(Array)
|
63
|
-
if direct_child_name =~
|
65
|
+
if direct_child_name =~ INDEX_REGEXP
|
64
66
|
child_node = node[direct_child_name.to_i]
|
65
67
|
raise NodeMutation::MethodNotSupported, "#{direct_child_name} is not supported for #{get_source(node)}" unless child_node
|
66
68
|
return child_node_range(child_node, nested_child_name) if nested_child_name
|
@@ -163,8 +165,8 @@ class NodeMutation::ParserAdapter < NodeMutation::Adapter
|
|
163
165
|
direct_child_name, nested_child_name = child_name.to_s.split('.', 2)
|
164
166
|
|
165
167
|
if node.is_a?(Array)
|
166
|
-
if direct_child_name =~
|
167
|
-
child_node = node[direct_child_name.to_i
|
168
|
+
if direct_child_name =~ INDEX_REGEXP
|
169
|
+
child_node = node[direct_child_name.to_i]
|
168
170
|
raise NodeMutation::MethodNotSupported, "#{direct_child_name} is not supported for #{get_source(node)}" unless child_node
|
169
171
|
return child_node_by_name(child_node, nested_child_name) if nested_child_name
|
170
172
|
return child_node
|
data/lib/node_mutation.rb
CHANGED
data/node_mutation.gemspec
CHANGED
@@ -29,7 +29,6 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
31
|
# Uncomment to register a new dependency of your gem
|
32
|
-
spec.add_dependency "activesupport", "< 7.0.0"
|
33
32
|
spec.add_dependency "erubis"
|
34
33
|
|
35
34
|
# For more information and examples about making a new gem, check out our
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: node_mutation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "<"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 7.0.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "<"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 7.0.0
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: erubis
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
82
|
- !ruby/object:Gem::Version
|
97
83
|
version: '0'
|
98
84
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
85
|
+
rubygems_version: 3.4.1
|
100
86
|
signing_key:
|
101
87
|
specification_version: 4
|
102
88
|
summary: ast node mutation apis
|