message_judgment 0.1.31 → 1.0

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
  SHA1:
3
- metadata.gz: 9e3e48499b54b4b4a282ed2f333cf69a17197956
4
- data.tar.gz: 146a3d5613da550b8ba9b9200bd9d56123f3c4cd
3
+ metadata.gz: 1e8347d067719249534d6b9b5de48ba9a18a80a9
4
+ data.tar.gz: 174ef2744c57149de5d0eca2661a61d9dee6c3ca
5
5
  SHA512:
6
- metadata.gz: fdbd3b0fd183879b813b71f184260fc6dc5f5dc1e4c17b1117bf27faef4a54128f5f19d9331ba0f8617b017ae372490507f1845bad0f3f95e1036597d4bc3856
7
- data.tar.gz: 65444946d0e80a3a848688b62563fc5ab6bb07cf07c6443ecc508c8c539043e225a09eab3d6621d2c37ccef83ba531f01f940ab064136a641f05b9066e1b820f
6
+ metadata.gz: df58323b6e1b0f13dd3a2d83414176c26834ca394dd06cf941b65425d19fe3d14cca1c36db33bd19317e911684109200438f3750930003c42331779acc8a412b
7
+ data.tar.gz: 4c7da7a97d49c4c4c9d7c0c4c2c66672851c1ed5e8978ae10ba9d1a7fd2a5bb269134b065522cb50a48adc8f27a330a0c3547db36c503c1cffbb276dc3e76950
data/README.md CHANGED
@@ -19,6 +19,13 @@ Or install it yourself as:
19
19
  $ gem install message_judgment
20
20
 
21
21
  ## Usage
22
+
23
+ `MessageJudgment.message_judgment?(message,targets,false)`
24
+ - First argument is message which you wanna check.
25
+ - Second argument is some crazy word which you wanna forbid.
26
+ - Third argument is option which you wanna select if you wanna make some forbidden words into "*",you don't need to specify.
27
+ but if you wanna make it just some blank,you gotta give false to the argument.
28
+
22
29
  ```ruby
23
30
  irb(main):001:0> require "message_judgment"
24
31
  => true
@@ -26,11 +33,23 @@ irb(main):002:0> message="Hello,I want your sex!"
26
33
  => "Hello,I want your sex!"
27
34
  irb(main):003:0> targets=["sex","fack"]
28
35
  => ["sex", "fack"]
29
- irb(main):004:0> MessageJudgment.message_judgment?(message,targets)
36
+ irb(main):004:0> MessageJudgment.message_judgment?(message,targets,false)
30
37
  => "Hello,I want your !"
31
38
 
32
39
  ```
33
40
 
41
+ ```ruby
42
+ irb(main):001:0> require "message_judgment"
43
+ => true
44
+ irb(main):002:0> message="Hello,I want your sex!"
45
+ => "Hello,I want your sex!"
46
+ irb(main):003:0> targets=["sex","fack"]
47
+ => ["sex", "fack"]
48
+ irb(main):004:0> MessageJudgment.message_judgment?(message,targets)
49
+ => "Hello,I want your ***!"
50
+ ```
51
+
52
+
34
53
  ## Development
35
54
 
36
55
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -47,4 +66,4 @@ The gem is available as open source under the terms of the [MIT License](http://
47
66
 
48
67
  ## Code of Conduct
49
68
 
50
- Everyone interacting in the MessageJudgment project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/NishidaRyu416/message_judgment/blob/master/CODE_OF_CONDUCT.md).
69
+ Everyone interacting in the MessageJudgment project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/message_judgment/blob/master/CODE_OF_CONDUCT.md).
@@ -1,9 +1,15 @@
1
1
  require "message_judgment/version"
2
2
 
3
3
  module MessageJudgment
4
- def self.message_judgment?(message,targets)
5
- targets.each do|target|
6
- message.slice!(target) if message.include?(target)
4
+ def self.message_judgment?(message,targets,option=true)
5
+ unless option==true
6
+ targets.each do|target|
7
+ message.slice!(target) if message.include?(target)
8
+ end
9
+ else
10
+ message.gsub!(/(#{targets.join('|')})/) do |target|
11
+ '*' * target.length
12
+ end
7
13
  end
8
14
  return message
9
15
  end
@@ -1,3 +1,3 @@
1
1
  module MessageJudgment
2
- VERSION = "0.1.31"
2
+ VERSION = "1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message_judgment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.31
4
+ version: '1.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - NishidaRyu416