node_mutation 1.15.2 → 1.15.3
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/node_mutation/action/append_action.rb +5 -0
- data/lib/node_mutation/action/delete_action.rb +1 -0
- data/lib/node_mutation/action/indent_action.rb +1 -0
- data/lib/node_mutation/action/insert_action.rb +1 -0
- data/lib/node_mutation/action/prepend_action.rb +5 -0
- data/lib/node_mutation/action/remove_action.rb +1 -0
- data/lib/node_mutation/action/replace_action.rb +1 -0
- data/lib/node_mutation/action/replace_with_action.rb +5 -0
- data/lib/node_mutation/action.rb +3 -1
- data/lib/node_mutation/result.rb +1 -1
- data/lib/node_mutation/struct.rb +1 -1
- data/lib/node_mutation/version.rb +1 -1
- data/sig/node_mutation/struct.rbs +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e184fa98da9cbfac3645ec4e89ac2201cdbbfd958c511a03050443a66c79b322
|
4
|
+
data.tar.gz: 7c7693df11e9cd74df33d5ef6949bc800ab3a6c4367836c799b76073800586d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17c9a5065bb703331ccf1996bb3895ff833336b768aca74751c52b885c0651c9c4bb19b989d026aa39b10cdf03b61ab43ddf3e5e1fe742aa837527b8e680279e
|
7
|
+
data.tar.gz: ba34afa52b6dacf07f5a9b736a31e2b1ad0c37e3a0717690d302f1a1e91ab366705d7ac840a903ada796d182731731823a7cf438e3d1de6c07ee1fcdb2ae5861
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
# ReplaceWithAction to replace code.
|
4
4
|
class NodeMutation::ReplaceWithAction < NodeMutation::Action
|
5
|
+
def initialize(node, code)
|
6
|
+
super(node, code)
|
7
|
+
@type = :replace
|
8
|
+
end
|
9
|
+
|
5
10
|
# The rewritten source code with proper indent.
|
6
11
|
#
|
7
12
|
# @return [String] rewritten code.
|
data/lib/node_mutation/action.rb
CHANGED
@@ -6,7 +6,9 @@ class NodeMutation::Action
|
|
6
6
|
# @return [Integer] start position
|
7
7
|
# @!attribute [rw] end
|
8
8
|
# @return [Integer] end position
|
9
|
-
|
9
|
+
# @!attribute [rw] type
|
10
|
+
# @return [Symbol] action type, :insert, :replace or :delete
|
11
|
+
attr_accessor :start, :end, :type
|
10
12
|
|
11
13
|
# Initialize an action.
|
12
14
|
#
|
data/lib/node_mutation/result.rb
CHANGED
@@ -19,7 +19,7 @@ class NodeMutation::Result
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def actions=(actions)
|
22
|
-
@actions = actions.map { |action| NodeMutation::Struct::Action.new(action.start, action.end, action.new_code) }
|
22
|
+
@actions = actions.map { |action| NodeMutation::Struct::Action.new(action.type, action.start, action.end, action.new_code) }
|
23
23
|
end
|
24
24
|
|
25
25
|
def to_json(*args)
|
data/lib/node_mutation/struct.rb
CHANGED
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.15.
|
4
|
+
version: 1.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ast node mutation apis
|
14
14
|
email:
|