node_mutation 1.3.2 → 1.3.3
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 +6 -1
- data/Gemfile.lock +1 -1
- data/lib/node_mutation/action.rb +0 -4
- data/lib/node_mutation/result.rb +6 -2
- data/lib/node_mutation/version.rb +1 -1
- data/lib/node_mutation.rb +5 -1
- data/sig/node_mutation/result.rbs +4 -0
- data/sig/node_mutation.rbs +2 -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: 544ec86ce71f51dab3347896a749a64d1d18f97a5d353f1e870c0396ff825dee
|
4
|
+
data.tar.gz: e366ae9c9eb0786111839a38bb27552bdf5177d6bfcf5b097900eb096553be2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5a2d40616eb991bcd38aef704ba656408659acb7460c33417bfa994e7f070d2863ad71ae6c8ebc72958f90dec1dbe3703ac9d2c42f9ba96001bc1a4a0b0a891
|
7
|
+
data.tar.gz: 308f7faedca3bab04cd0866b1f862aad144fd580042ee82fe0ad8773bbe5f2e7a2adaa2cfcd0f8d29e4d0f221238ae655e5c37f7a282cb9edc9f78d5fb28e1eb
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# NodeMutation
|
2
2
|
|
3
|
-
## 1.3.
|
3
|
+
## 1.3.3 (2022-09-16)
|
4
|
+
|
5
|
+
* Format `actions` in test result
|
6
|
+
* Add `file_path` attribute to `NodeMutation::Result`
|
7
|
+
|
8
|
+
## 1.3.2 (2022-09-15)
|
4
9
|
|
5
10
|
* Add `NodeMutation::Action.to_hash`
|
6
11
|
* Add `NodeMutation::Result.to_hash`
|
data/Gemfile.lock
CHANGED
data/lib/node_mutation/action.rb
CHANGED
data/lib/node_mutation/result.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class NodeMutation::Result
|
4
|
+
attr_accessor :file_path
|
5
|
+
|
4
6
|
def initialize(options)
|
5
7
|
@options = options
|
6
8
|
end
|
@@ -22,8 +24,10 @@ class NodeMutation::Result
|
|
22
24
|
end
|
23
25
|
|
24
26
|
def to_hash
|
25
|
-
|
26
|
-
|
27
|
+
hash = { file_path: file_path }
|
28
|
+
@options.each do |key, value|
|
29
|
+
hash[key] = value.is_a?(Array) ? value.map { |action| action.to_h } : value
|
27
30
|
end
|
31
|
+
hash
|
28
32
|
end
|
29
33
|
end
|
data/lib/node_mutation.rb
CHANGED
@@ -257,7 +257,7 @@ class NodeMutation
|
|
257
257
|
NodeMutation::Result.new(
|
258
258
|
affected: true,
|
259
259
|
conflicted: !conflict_actions.empty?,
|
260
|
-
actions: @actions
|
260
|
+
actions: format_actions(@actions)
|
261
261
|
)
|
262
262
|
end
|
263
263
|
|
@@ -283,4 +283,8 @@ class NodeMutation
|
|
283
283
|
end
|
284
284
|
conflict_actions
|
285
285
|
end
|
286
|
+
|
287
|
+
def format_actions(actions)
|
288
|
+
actions.map { |action| OpenStruct.new(start: action.start, end: action.end, new_code: action.new_code ) }
|
289
|
+
end
|
286
290
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class NodeMutation::Result
|
2
|
+
attr_accessor file_path (): String
|
3
|
+
|
2
4
|
def initialize: (source: String) -> NodeMutation::Result
|
3
5
|
|
4
6
|
def affected?: () -> bool
|
@@ -6,4 +8,6 @@ class NodeMutation::Result
|
|
6
8
|
def conflicted?: () -> bool
|
7
9
|
|
8
10
|
def new_source: () -> String
|
11
|
+
|
12
|
+
def actions: () -> Array[Hash]
|
9
13
|
end
|
data/sig/node_mutation.rbs
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.3.
|
4
|
+
version: 1.3.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: 2022-09-
|
11
|
+
date: 2022-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|