node_mutation 1.8.0 → 1.8.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: ff377f6938abd45d3c9de294e7f2aa495733ff48f95a36939bf38bae63f84e90
4
- data.tar.gz: a4981d65f8b36882e5b9cf105a89798f14bf591716bb66cc0b8a2e0d029f9339
3
+ metadata.gz: be47289a83fa7295154056c8c6adc404f4f190d580a47dc78660dcfd082917d1
4
+ data.tar.gz: 15f40478c899eb9b4e8fd809edc4ebec139f8d85a98bd7573103fee2b62ebde6
5
5
  SHA512:
6
- metadata.gz: 1987c04293979252253faa150cef7309f31fe3b66abb6f2c17274f9eb1b486025f2be36867dfa6fc665a90ac84555b8234318be44165f798388f6b88e4d8c952
7
- data.tar.gz: 30c8ac0e01b00390a959728ff82e6a4d3d263b1e46b56c111e600a40ebaab883b09652ff74f60636fecd6371d5dab6d31e32bdff335c353339c469c72fd67618
6
+ metadata.gz: 25e98cb3610598d9a30de2f880c071a04020c4507c8700826aa047f48179b340ad0e8e258f2301738717c5a7dd809ed9b78d75f0f1b3f9b3f243371c3d132fa5
7
+ data.tar.gz: 0e615252351fa511f0e1be269c74fdd77bf1477ec97745bb5cfb747a9657356cdedde24357001fcfd4b879cb47b5daf603e7e3af0c82716156de1e531c68f2a3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # NodeMutation
2
2
 
3
+ ## 1.8.2 (2023-01-17)
4
+
5
+ * Drop `activesupport`
6
+
7
+ ## 1.8.1 (2022-12-26)
8
+
9
+ * `child_node_by_name` index starts from `0`
10
+
3
11
  ## 1.8.0 (2022-12-26)
4
12
 
5
13
  * `child_node_range` index starts from `0`
data/Gemfile.lock CHANGED
@@ -1,22 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- node_mutation (1.8.0)
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 =~ /\A-?\d+\z/
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 =~ /\A\d+\z/
167
- child_node = node[direct_child_name.to_i - 1]
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class NodeMutation
4
- VERSION = "1.8.0"
4
+ VERSION = "1.8.2"
5
5
  end
data/lib/node_mutation.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'ostruct'
4
- require 'active_support/core_ext/array'
5
4
 
6
5
  require_relative "node_mutation/version"
7
6
 
@@ -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.0
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: 2022-12-26 00:00:00.000000000 Z
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.3.26
85
+ rubygems_version: 3.4.1
100
86
  signing_key:
101
87
  specification_version: 4
102
88
  summary: ast node mutation apis