node_mutation 1.4.1 → 1.4.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: c039ce434de2c9f04450657464f649b1005851b3beaacc83be674833a0756ffa
4
- data.tar.gz: e2e64db507b3099dc2f8709b0c6eb5f0cfb990ad1f5c2061eab8666212306a3a
3
+ metadata.gz: 739b5f521fb0df8ea2e4b47f11851574e4e771528923fa89e0d7c5a2ed8a0b7b
4
+ data.tar.gz: fe8c44a82ef5a21df6390936f7b5b91700c8a7f965e34ada1229ef2443b013c6
5
5
  SHA512:
6
- metadata.gz: ff18089505355b7527c220ce0ed22ba84f7bef3e4789deb656a9dfe49b962c984e313bc1ade369bcf6ba01006ff2dd102f38e319a06b77a38522fecc5b2dba22
7
- data.tar.gz: 8feb7df10f01fffa63af2b913f129a95c55ba81af0446aaeea6a1282e1c1f1ee6648f812acce635b09cf2905def86227c42dbc92bc0b8e80fa7f54cc5e04530b
6
+ metadata.gz: b2dd045bc579535b9ba6c6ece53c8f19ae840385682ca0f3759713b5ee36abca574cbf4a80c065b024ecbf40d23a39c423b6e7ecd3a82d4417f7b65583b78885
7
+ data.tar.gz: 298af0ed4518668a784df4e5c3fec4a3904fa63fc325ace94d90ec869cd111efe5e20829b6f0f8902264f38fe87ea2359c65db1ada2170813b4ce62886fdbaef
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # NodeMutation
2
2
 
3
+ ## 1.4.3 (2022-09-24)
4
+
5
+ * Update source only if `new_code` is not `nil`
6
+
7
+ ## 1.4.2 (2022-09-23)
8
+
9
+ * Add `NodeMutation#to_json`
10
+
3
11
  ## 1.4.1 (2022-09-23)
4
12
 
5
13
  * Add `NodeMutation#noop`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- node_mutation (1.4.1)
4
+ node_mutation (1.4.3)
5
5
  activesupport (< 7.0.0)
6
6
  erubis
7
7
 
@@ -23,6 +23,10 @@ class NodeMutation::Result
23
23
  @options[:new_source]
24
24
  end
25
25
 
26
+ def to_json(*args)
27
+ to_hash.to_json(*args)
28
+ end
29
+
26
30
  def to_hash
27
31
  hash = { file_path: file_path }
28
32
  @options.each do |key, value|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class NodeMutation
4
- VERSION = "1.4.1"
4
+ VERSION = "1.4.3"
5
5
  end
data/lib/node_mutation.rb CHANGED
@@ -234,7 +234,7 @@ class NodeMutation
234
234
  raise ConflictActionError, "mutation actions are conflicted"
235
235
  end
236
236
  @actions.reverse_each do |action|
237
- source[action.start...action.end] = action.new_code
237
+ source[action.start...action.end] = action.new_code if action.new_code
238
238
  end
239
239
  NodeMutation::Result.new(
240
240
  affected: true,
@@ -10,4 +10,6 @@ class NodeMutation::Result
10
10
  def new_source: () -> String
11
11
 
12
12
  def actions: () -> Array[Hash]
13
+
14
+ def to_json: (*args) -> String
13
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: node_mutation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang