node_mutation 1.12.2 → 1.12.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: cf57adfc552f6b661bf4c08a35976f017dc7439c914cb1e419e656952d77bcef
4
- data.tar.gz: ee142c7f5b1b8e2ae7a0b51a36dd8718232918c2fa57595e84470e284fe86411
3
+ metadata.gz: 3c09d8d3b9a1b4185382f7117d766d6220d9f9cbe4851f86af6c99e32af2ba88
4
+ data.tar.gz: e392926a8e647d85028c5d41c3890bea801f47dae425b885ff1892aaf8b396b2
5
5
  SHA512:
6
- metadata.gz: 6a4106b2a6324eac65cb782cb3e3863b4544f7798bb87313205bb5b0cf62d55fc3ed75feb36161fe4810ca5ae030f26bb66347d5b1779a035123a5cddaff12b3
7
- data.tar.gz: fa65851e47d51b26ca21efc76d4b16ebc1d3743e7dae9d616ba696dc2491e600077b934aea8f3c8db5345c9220ddbf7a883461058d0c73e381f1e5ef99f589db
6
+ metadata.gz: 6bb3a9d27929b69bba72947e39160163d671a7ac493d0b861057b1e08fd651e4bbcadc90f56d9b4ae8a7ee825aa1c207af7136f1b2afb11a7533b0c9898d211d
7
+ data.tar.gz: '0943c3dfd903a6b9e789cfcb7289bbe2fed18f37a1176210ceff267233383c879813b67e3ff2e915e8c179f6144afe9c5ba5fb8baf3055845a93dd2885a58fce'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # NodeMutation
2
2
 
3
+ ## 1.12.3 (2023-03-30)
4
+
5
+ * `remove_whitespace` for both before and after whitespace
6
+
3
7
  ## 1.12.2 (2023-03-25)
4
8
 
5
9
  * `remove_whitespace` handles more cases
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- node_mutation (1.12.2)
4
+ node_mutation (1.12.3)
5
5
  erubis
6
6
 
7
7
  GEM
@@ -57,12 +57,18 @@ class NodeMutation::Action
57
57
  # e.g. `%i[foo bar]`, if we remove `foo`, the whitespace should also be removed,
58
58
  # the code should be changed to `%i[bar]`.
59
59
  def remove_whitespace
60
+ if file_source[@end] == ' ' && file_source[@start - 1] == ' '
61
+ @start -= 1
62
+ @end += 1
63
+ return
64
+ end
65
+
60
66
  if ["\n", ';', ')', ']', '}', '|', nil].include?(file_source[@end]) && file_source[@start - 1] == ' '
61
67
  @start -= 1
62
68
  return
63
69
  end
64
70
 
65
- if [' ', '(', '[', '{', '|'].include?(file_source[@start - 1]) && file_source[@end] == ' '
71
+ if ['(', '[', '{', '|'].include?(file_source[@start - 1]) && file_source[@end] == ' '
66
72
  @end += 1
67
73
  end
68
74
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class NodeMutation
4
- VERSION = "1.12.2"
4
+ VERSION = "1.12.3"
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.2
4
+ version: 1.12.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-03-25 00:00:00.000000000 Z
11
+ date: 2023-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubis