word_censored 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/lib/word_censored/version.rb +1 -1
- data/lib/word_censored.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ecc5c3d0d5e018379f0cb504fba466a6fbaab0436868fb06fb13100c2a961e9
|
4
|
+
data.tar.gz: 315d1c2d24443a823b629d36ef62917bf04284a30e018537f3f1b7c63bce0442
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 575077fd3ef9fe3d78344757479dcc7ddd7c9fb071fa1455d4b2b384874d3ab707f4d2f426b9edb5c829f983ac33f79c86beca4b93469e08b142e0ab28083c43
|
7
|
+
data.tar.gz: ec148772620dd3d39bb24d2783e20c1fc5afbbde4e8f4199078f108d38363cca1e750617e9a0cb422d2619f448084b0244fb0a36f1f9d81b96da69d54a1ab85e
|
data/README.md
CHANGED
@@ -22,7 +22,19 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
Add this line to your class where you gonna use this gem:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
include WordCensored
|
29
|
+
```
|
30
|
+
|
31
|
+
then use it:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
filter('bad word')
|
35
|
+
|
36
|
+
> *** ****
|
37
|
+
```
|
26
38
|
|
27
39
|
## Development
|
28
40
|
|
data/lib/word_censored.rb
CHANGED
@@ -17,6 +17,7 @@ module WordCensored
|
|
17
17
|
|
18
18
|
@str_array.each_with_index do |word, index|
|
19
19
|
next if index <= current_index
|
20
|
+
next if preprocess_word(word).strip.empty?
|
20
21
|
|
21
22
|
first_letter = preprocess_word(word)[0].match?(REGEX_FIRST_LETTER) ? preprocess_word(word)[0] : 'other'
|
22
23
|
index_badword = detect_badword(blacklist[first_letter], index, index)
|