wr_vocab_blacklist 0.0.2 → 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/wr_vocab_blacklist.rb +7 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3c525fd34868edaba82a04225deabb2d9683b4f74718b80f9649e5da0b9ab4f
4
- data.tar.gz: dce274cac6af4d2a1e84b4701f7783a014a8f6b8d7a5b2be084b2892dc6f57d5
3
+ metadata.gz: c0d4912cb67372f12739904213e7bc4ad9e505731a1da1e25cb3d924f86f1c1a
4
+ data.tar.gz: 20fb7fd6305d88070ff87c82dd947f760fe01ea632d05cc8c92470daaa7a3d13
5
5
  SHA512:
6
- metadata.gz: ace4822f4a0394b542f7738bf4f8c488f35504ff1cb3cdeb4c280fb78fe31a5b1ebbc58a1ee6c6de26c24d14980ccb6b6a89a0f1e037c285f136ae00f0e20d93
7
- data.tar.gz: bbd50a6c83454a9055f4735ee50c40095103bcc4e3e75f4d95a9df60ed0b6ed8bf4bd3d3cabcd1592b66035df17510425fdf5b107dfb7fdc45916abaeae4d81a
6
+ metadata.gz: 7993f263cdbacbeb6b0217ebc2f81aeae838f00f9ef612faaa00f86bca225fd50a5e469e794c00194cc24b701add2f5441c0ccbcc5075cee3628deadbfba41a3
7
+ data.tar.gz: 0340004b8d6d6e8b34b09283b9fe761d91139106558d5eb50362b0763f33313175c54d83c624e45b713a84e2c05c762dad2cb1340b741de1ee081ee9c3246a70
@@ -45,7 +45,7 @@ class VocabBlacklist
45
45
  # match number of characters for any replace_with that is 1 character
46
46
  if replace_with.length == 1 && keep_first_letter
47
47
  str.gsub!(/#{ bad_phrase }/i, bad_phrase[0])
48
- elsif if replace_with.length == 1
48
+ elsif replace_with.length == 1
49
49
  str.gsub!(/#{ bad_phrase }/i, replace_with * bad_phrase.length)
50
50
  else
51
51
  str.gsub!(/#{ bad_phrase }/i, replace_with)
@@ -65,7 +65,9 @@ class VocabBlacklist
65
65
  if !is_whitelisted
66
66
  if check_full_words_csv(word, age)
67
67
  # match number of characters for any replace_with that is 1 character
68
- if replace_with.length == 1
68
+ if replace_with.length == 1 && keep_first_letter
69
+ sub_working_word.gsub!(/#{ word }/i, word[0])
70
+ elsif replace_with.length == 1
69
71
  sub_working_word.gsub!(/#{ word }/i, replace_with * word.length)
70
72
  else
71
73
  sub_working_word.gsub!(/#{ word }/i, replace_with)
@@ -74,7 +76,9 @@ class VocabBlacklist
74
76
 
75
77
  if GREEDY_WORDS.any? { |w| word.include?(w) }
76
78
  # match number of characters for any replace_with that is 1 character
77
- if replace_with.length == 1
79
+ if replace_with.length == 1 && keep_first_letter
80
+ sub_working_word = sub_working_word[0]
81
+ elsif replace_with.length == 1
78
82
  sub_working_word = replace_with * sub_working_word.length
79
83
  else
80
84
  sub_working_word = replace_with
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wr_vocab_blacklist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Sherrid
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2022-10-03 00:00:00.000000000 Z
15
+ date: 2022-10-04 00:00:00.000000000 Z
16
16
  dependencies: []
17
17
  description: Detect words and partial-words that shouldn't be used on Whooo's Reading
18
18
  website