soap 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTZlODQ5Yzk3MDdkMGFlMWQ3MjM0MGZjYWNlMzQ3MjIyNmJlZTVlYw==
4
+ NDAyMTI2YzJmYzAwY2ZlOGY3NmQyNjg2Njg0ZTliNGZmYzY1N2I0Ng==
5
5
  data.tar.gz: !binary |-
6
- ZmUzMjEwMzg0MTI2MTgwMzllMjdhOTM5ZmFjYmM2MmM1MDc2NzhlNg==
6
+ NzQ3ZDkxZDRmOWM1M2Y5YTg1NDBkYTNmOTQwNDA0ODgzMTYzZjU3Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjdiOTZiYWVmZmIxZjA1NzNlYjRkOWM4Y2M2NWFjYmExNThlNjhjZWIzMWNl
10
- ODA4NTZiMmQ1MDc1NjhmYjhmOGIxNTQyNjQ1Njk3MTY2ZGRmODlkYmMzN2Q1
11
- ZmYyOGMwYTdjNGUxMzk4OTBjYjUzYTAxNGJhZGI5N2I4OGY2ODI=
9
+ MGU3NzU5ZDBhNGMwYTQxMGQ5ODE3NTA5NzZhZDcyM2Y4ZGIyOTg2ZTIzNmUx
10
+ MzZjZDI5MDdmNDZkNzMyNGEzNjQ0YzkyNmUxMzI2ODI5ZmVlMzhhNTJkZGU5
11
+ Y2VlY2U1MmY2YjQxNjg1OGViMmZhZWYyNTM2NDNjYTFiZGM4NGI=
12
12
  data.tar.gz: !binary |-
13
- Zjg1MTg5ZjU4ZTlhOTYxYmQwZGIxMjQxNzMwZTJkYzg0MWQ4NjcwZTAwYjA0
14
- YjdjN2QyYzVmMzE2YmM3NjgxZTU3OTlkMjI3MmZmNGRjYmRmY2ZlMWVlMjFm
15
- MTVlMzRkYzcwY2Y1YWQ4MTY0OTFlYzA2ZjYyMWE5MTc5YzE4YmE=
13
+ MDQ5ZmRkOTgwODNlZjA0YmViMmVhYzBhYWY2NjYxNDQ2ODYzZmJjY2VhNDU2
14
+ ZTg4NzQ2YjA5MWIwNDVkNWZlOTE2NGUzNmRlYjI1NGJhZjRkNDhiYjgyNzVj
15
+ NDY0MzBkMDQ1MDY2ZTkwNGU4MTkyOGQxZjU0YTY3MTlkMjE3OGY=
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Jason Nochlin
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ # Soap
2
+
3
+ A profanity detector for random strings
4
+
5
+ # Installation
6
+
7
+ `gem install soap`
8
+
9
+ # Quick Start
10
+
11
+ `> Soap.detect_profanity SecureRandom.base64(10000) # => likely returns 'true'`
12
+
13
+ # Purpose
14
+
15
+ Soap was extracted from a url shortener where it ensured that the
16
+ random identifiers created for use in short urls did not accidentally contain
17
+ any offensive words
18
+
19
+ # Contributing to Soap
20
+
21
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
22
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
23
+ * Fork the project
24
+ * Start a feature/bugfix branch
25
+ * Commit and push until you are happy with your contribution
26
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
27
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
28
+
29
+ # Copyright
30
+
31
+ Copyright (c) 2014 Jason Nochlin. See LICENSE.txt for
32
+ further details.
33
+
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+ require "bundler/gem_tasks"
3
+
4
+ require 'rake/testtask'
5
+ Rake::TestTask.new(:test) do |test|
6
+ test.libs << 'lib' << 'test'
7
+ test.pattern = 'test/**/test_*.rb'
8
+ test.verbose = true
9
+ end
10
+
11
+ task :default => :test
@@ -0,0 +1,36 @@
1
+ module Soap
2
+ WORDS = File.read(File.expand_path('../words.txt', __FILE__)).split("\n")
3
+ LETTERS = {
4
+ 'a' => 'a4',
5
+ 'b' => 'b6',
6
+ 'c' => 'c',
7
+ 'd' => 'd',
8
+ 'e' => 'e3',
9
+ 'f' => 'f',
10
+ 'g' => 'g9',
11
+ 'h' => 'h',
12
+ 'i' => 'i1l',
13
+ 'j' => 'j',
14
+ 'k' => 'k',
15
+ 'l' => 'i1l',
16
+ 'm' => 'm',
17
+ 'n' => 'n',
18
+ 'o' => 'o0',
19
+ 'p' => 'p',
20
+ 'q' => 'q',
21
+ 'r' => 'r',
22
+ 's' => 's',
23
+ 't' => 't1',
24
+ 'u' => 'u',
25
+ 'v' => 'v',
26
+ 'w' => 'w',
27
+ 'x' => 'x',
28
+ 'y' => 'y',
29
+ 'z' => 'z',
30
+ }
31
+ CHAR_CLASSES = LETTERS.inject({}) { |acc,(letter,set_string)| acc[letter] = '['+set_string+']'; acc }
32
+ PATTERN = %r{#{WORDS.map {|word| word.split('').map{|letter|CHAR_CLASSES[letter]}.join('') }.join('|')}}
33
+ def self.detect_profanity(test_string)
34
+ not test_string.downcase.match(PATTERN).nil?
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ module Soap
2
+ VERSION = '1.0.2'
3
+ end
@@ -0,0 +1,146 @@
1
+ shit
2
+ piss
3
+ fuck
4
+ cunt
5
+ cock
6
+ suck
7
+ tits
8
+ poop
9
+ ass
10
+ lick
11
+ hole
12
+ ball
13
+ bitch
14
+ blow
15
+ bun
16
+ bum
17
+ butt
18
+ chink
19
+ jerk
20
+ crap
21
+ balls
22
+ beaver
23
+ belly
24
+ bitch
25
+ blow
26
+ boner
27
+ bucket
28
+ cunt
29
+ bum
30
+ butch
31
+ butt
32
+ butt
33
+ fucker
34
+ butt
35
+ hair
36
+ chink
37
+ circle
38
+ jerk
39
+ clam
40
+ clit
41
+ cobia
42
+ cock
43
+ cocks
44
+ cooter
45
+ crap
46
+ cum
47
+ cummer
48
+ cums
49
+ cunt
50
+ cunts
51
+ damn
52
+ dick
53
+ dike
54
+ dildo
55
+ dildos
56
+ dink
57
+ dinks
58
+ dong
59
+ douche
60
+ dyke
61
+ fag
62
+ fagget
63
+ faggit
64
+ faggot
65
+ faggs
66
+ fagot
67
+ fagots
68
+ fags
69
+ fart
70
+ farted
71
+ farts
72
+ farty
73
+ fatass
74
+ fatso
75
+ fuck
76
+ fucked
77
+ fucker
78
+ fuckin
79
+ fuckme
80
+ fucks
81
+ fuk
82
+ fuks
83
+ gaysex
84
+ gonads
85
+ gook
86
+ guinne
87
+ hard
88
+ homo
89
+ hooker
90
+ horny
91
+ hotsex
92
+ hussy
93
+ jack
94
+ jap
95
+ jerk
96
+ jism
97
+ jiz
98
+ jizm
99
+ jizz
100
+ kike
101
+ kock
102
+ kondum
103
+ kraut
104
+ kum
105
+ kummer
106
+ kums
107
+ lesbo
108
+ merde
109
+ mick
110
+ muff
111
+ nigger
112
+ orgasm
113
+ pecker
114
+ penis
115
+ phuk
116
+ phuked
117
+ phuks
118
+ phuq
119
+ pimp
120
+ piss
121
+ pissed
122
+ pissrr
123
+ pisses
124
+ pissin
125
+ prick
126
+ pricks
127
+ pussy
128
+ pussys
129
+ queer
130
+ retard
131
+ screw
132
+ shit
133
+ shited
134
+ shits
135
+ shitty
136
+ slag
137
+ sleaze
138
+ slut
139
+ sluts
140
+ smut
141
+ snatch
142
+ spunk
143
+ twat
144
+ whore
145
+ wop
146
+ sex
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'active_support/secure_random'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'soap'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,23 @@
1
+ require 'helper'
2
+
3
+ class TestSoap < Test::Unit::TestCase
4
+ def test_detect_anything_that_looks_profane
5
+ [
6
+ ['SHiT', true],
7
+ ['plain', false],
8
+ ].
9
+ each do |test, result|
10
+ assert(Soap.detect_profanity(test) == result, "Incorrectly detected #{test}")
11
+ end
12
+ end
13
+ def test_n_random_strings_for_detection_frequency
14
+ length = 10
15
+ n = 10000
16
+ (1..n).
17
+ map { ActiveSupport::SecureRandom.base64(length).to_s.gsub('/', '+')[0,length] }.
18
+ select { |i| Soap.detect_profanity(i) }.
19
+ count.tap { |profanities|
20
+ puts "#{profanities} detected in #{n} strings of length #{length}"
21
+ }
22
+ end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Nochlin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2014-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -43,7 +43,15 @@ email: hundredwatt@gmail.com
43
43
  executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
- files: []
46
+ files:
47
+ - LICENSE.txt
48
+ - README.md
49
+ - Rakefile
50
+ - lib/soap.rb
51
+ - lib/soap/version.rb
52
+ - lib/words.txt
53
+ - test/helper.rb
54
+ - test/test_soap.rb
47
55
  homepage: http://github.com/hundredwatt/soap
48
56
  licenses: []
49
57
  metadata: {}