node_mutation 1.4.0 → 1.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14bd090b6d48eddaf61babaf018060fd90c923fa6011c354060f916bdd67dc69
4
- data.tar.gz: 19318b49488ccc6bc4db47fda0c78cdcd88b2df7f9a27acf27887772108e3470
3
+ metadata.gz: 976a6458a2d0fec8c240abf9c2be1d19aa7e95fe696df882df88136b71d5508c
4
+ data.tar.gz: 508d7c2b4cf4e64b4cf5d258af62037b33222af4e25faf1f5fae8fb18e35d6cc
5
5
  SHA512:
6
- metadata.gz: a73fe4094b0d71a06ddb12480c9f71e8fd3c49d845d8648a78e77c89eb59b4feeea963ba4ebbd58252135b32f5271a335f46942ed232be571b77b35ae8390d6b
7
- data.tar.gz: 40588082698b6e0c8f3a891cd281e5bc9f571a43d1c3de71e63a8ae7489825329a236de14fb8eed1237c9d94840db00dd72671b6b5505adbe77165f65e7f5916
6
+ metadata.gz: a00c2bad64ac0f931423bb4ee0ea5dcb0893d6dec2784902b2cee30a2a6723a5cace395133056b3703c213f2283eb4dec0946b2cafea9e5372e3bf8cad077aa3
7
+ data.tar.gz: 3a3b59553a9261f211b5ab9b9378efbc47dca750e26d9d75914b3951a4a24634ac9ac8ac325589fe6a4d3bc56e8f3932d4ec3cdb95caa2cc28605d2c10e8ceec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # NodeMutation
2
2
 
3
+ ## 1.4.2 (2022-09-23)
4
+
5
+ * Add `NodeMutation#to_json`
6
+
7
+ ## 1.4.1 (2022-09-23)
8
+
9
+ * Add `NodeMutation#noop`
10
+
3
11
  ## 1.4.0 (2022-09-20)
4
12
 
5
13
  * Add `NoopAction`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- node_mutation (1.4.0)
4
+ node_mutation (1.4.2)
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.0"
4
+ VERSION = "1.4.2"
5
5
  end
data/lib/node_mutation.rb CHANGED
@@ -208,6 +208,12 @@ class NodeMutation
208
208
  @actions << WrapAction.new(node, with: with).process
209
209
  end
210
210
 
211
+ # No operation.
212
+ # @param node [Node] ast node
213
+ def noop(node)
214
+ @actions << NoopAction.new(node).process
215
+ end
216
+
211
217
  # Process actions and return the new source.
212
218
  #
213
219
  # If there's an action range conflict,
@@ -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
@@ -39,6 +39,8 @@ module NodeMutation[T]
39
39
 
40
40
  def wrap: (node: T, with: String) -> void
41
41
 
42
+ def noop: (node: T) -> void
43
+
42
44
  def process: () -> NodeMutation::Result
43
45
 
44
46
  def test: () -> NodeMutation::Result
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.4.0
4
+ version: 1.4.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-09-20 00:00:00.000000000 Z
11
+ date: 2022-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport