node_mutation 1.21.1 → 1.21.3

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: e659aa61170c013d38f7ae7fb18d7ce236b588cdd573d62af6a3eab683216a9f
4
- data.tar.gz: 9fe3a31666deda95fef8cfd668e09b880d484e6763483ec573b3e5869e8b593b
3
+ metadata.gz: 2db42bf57c1ecb342033989ea018607b34f25647565ad8db86d44cb0f0713b10
4
+ data.tar.gz: 9ab4cad235711dee0ff3c60a8547a0fa68bff99f47a12b331091a88c03edd08b
5
5
  SHA512:
6
- metadata.gz: a1f3b204d8cb0e74e7d9afc52893e7b2930ac51104ae61975406d93de2c4e617fef2afd12e57e73f15efd6d9ad11a19a57c2adcad14893b99f778dd0ebbde0d5
7
- data.tar.gz: a193a00b15323f8edcebd30dbd225c0e82a5a8831e4d3ae54a16aa211c0ba7e694283aea25353e081cb94e7db3a707c856de73837f6da04c1fa4700f522911e1
6
+ metadata.gz: 5f9efba9693d6792033c04ef34313f2effed85b0f4f7392a6c669d71e383520420faa258f44dd7e72252785c60bbdb4cfe0e109af3e489a1046174f8370dc8c3
7
+ data.tar.gz: cd092b7e5babc2bf96f8fbd7b9009ef0b39ba056e68d9db92f4e175568e040465ce3da636a423674ade58a57621f03b86af35ee8ac38d5f82fc9d938956dc70f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # NodeMutation
2
2
 
3
+ ## 1.21.3 (2023-10-03)
4
+
5
+ * Call `Action#to_struct` explicitly
6
+
7
+ ## 1.21.2 (2023-10-02)
8
+
9
+ * Result saves group actions properly
10
+
3
11
  ## 1.21.1 (2023-10-01)
4
12
 
5
13
  * Update `parser_node_ext` to 1.2.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- node_mutation (1.21.1)
4
+ node_mutation (1.21.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -41,6 +41,11 @@ class NodeMutation::Action
41
41
  end
42
42
  end
43
43
 
44
+ def to_struct
45
+ to_struct_actions = @actions ? @actions.map(&:to_struct) : nil
46
+ NodeMutation::Struct::Action.new(@type, @start, @end, new_code, to_struct_actions)
47
+ end
48
+
44
49
  protected
45
50
 
46
51
  # Calculate the begin the end positions.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class NodeMutation::Result
4
- attr_accessor :file_path, :new_source
4
+ attr_accessor :file_path, :new_source, :actions
5
5
  attr_reader :actions
6
6
 
7
7
  def initialize(affected:, conflicted:)
@@ -18,13 +18,6 @@ class NodeMutation::Result
18
18
  @conflicted
19
19
  end
20
20
 
21
- def actions=(actions)
22
- @actions =
23
- actions.map { |action|
24
- NodeMutation::Struct::Action.new(action.type, action.start, action.end, action.new_code, action.actions)
25
- }
26
- end
27
-
28
21
  def to_json(*args)
29
22
  data = { affected: affected?, conflicted: conflicted? }
30
23
  data[:new_source] = new_source if new_source
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class NodeMutation
4
- VERSION = "1.21.1"
4
+ VERSION = "1.21.3"
5
5
  end
data/lib/node_mutation.rb CHANGED
@@ -302,7 +302,7 @@ class NodeMutation
302
302
  end
303
303
 
304
304
  result = NodeMutation::Result.new(affected: true, conflicted: !conflict_actions.empty?)
305
- result.actions = @actions
305
+ result.actions = @actions.map(&:to_struct)
306
306
  result
307
307
  end
308
308
 
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.21.1
4
+ version: 1.21.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-10-01 00:00:00.000000000 Z
11
+ date: 2023-10-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ast node mutation apis
14
14
  email: