node_mutation 1.12.1 → 1.12.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: 377cc05adfb7a9f55647b1850a325d9ddcb20004e2574af39657248bd05a51b4
4
- data.tar.gz: 233c08e3fa49855270f62c11e1d9587b77886e9a6edded54f27096a9dc951849
3
+ metadata.gz: cf57adfc552f6b661bf4c08a35976f017dc7439c914cb1e419e656952d77bcef
4
+ data.tar.gz: ee142c7f5b1b8e2ae7a0b51a36dd8718232918c2fa57595e84470e284fe86411
5
5
  SHA512:
6
- metadata.gz: 593a0319dc715d587137e840d66694ed6f8c5d4a73312eb20847eee8383b4f47910f25d1d14f1e3fb95bee3ee1ab6627a08fdd2fa40c837c1a4d8e3422237066
7
- data.tar.gz: 9aca39fb58ae4b02687a310fdcc3a7f388ebc86bcdce29b8efff24069077e3ed9194c9556bd833737160c8a220af87c010eedfd588e71f98c5b3bdae0d578cd3
6
+ metadata.gz: 6a4106b2a6324eac65cb782cb3e3863b4544f7798bb87313205bb5b0cf62d55fc3ed75feb36161fe4810ca5ae030f26bb66347d5b1779a035123a5cddaff12b3
7
+ data.tar.gz: fa65851e47d51b26ca21efc76d4b16ebc1d3743e7dae9d616ba696dc2491e600077b934aea8f3c8db5345c9220ddbf7a883461058d0c73e381f1e5ef99f589db
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # NodeMutation
2
2
 
3
+ ## 1.12.2 (2023-03-25)
4
+
5
+ * `remove_whitespace` handles more cases
6
+
3
7
  ## 1.12.1 (2023-03-23)
4
8
 
5
9
  * Define `Action`, `Location` and `Range` in `NodeMutation::Struct`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- node_mutation (1.12.1)
4
+ node_mutation (1.12.2)
5
5
  erubis
6
6
 
7
7
  GEM
@@ -54,12 +54,15 @@ class NodeMutation::Action
54
54
  end
55
55
 
56
56
  # remove unused whitespace.
57
- # e.g. `foobar(foo, bar)`, if we remove `foo`, the whitespace should also be removed,
58
- # the code should be changed to `foobar(bar)`.
57
+ # e.g. `%i[foo bar]`, if we remove `foo`, the whitespace should also be removed,
58
+ # the code should be changed to `%i[bar]`.
59
59
  def remove_whitespace
60
- return unless [' ', '('].include?(file_source[@start - 1])
60
+ if ["\n", ';', ')', ']', '}', '|', nil].include?(file_source[@end]) && file_source[@start - 1] == ' '
61
+ @start -= 1
62
+ return
63
+ end
61
64
 
62
- while file_source[@end] == ' '
65
+ if [' ', '(', '[', '{', '|'].include?(file_source[@start - 1]) && file_source[@end] == ' '
63
66
  @end += 1
64
67
  end
65
68
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class NodeMutation
4
- VERSION = "1.12.1"
4
+ VERSION = "1.12.2"
5
5
  end
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.12.1
4
+ version: 1.12.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: 2023-03-23 00:00:00.000000000 Z
11
+ date: 2023-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubis
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubygems_version: 3.4.7
86
+ rubygems_version: 3.4.6
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: ast node mutation apis