profanity_filter 0.0.0 → 0.0.1
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.
- data/README.rdoc +7 -7
- data/VERSION +1 -1
- data/lib/profanity_filter.rb +4 -1
- data/profanity_filter.gemspec +70 -0
- data/test/profanity_filter_test.rb +7 -0
- metadata +11 -5
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=
|
1
|
+
= The Profanity Filter for Rails
|
2
2
|
|
3
3
|
This plugin will allow you to filter profanity using basic replacement or a dictionary term.
|
4
4
|
|
@@ -8,7 +8,9 @@ This plugin is provided as is - therefore, the creators and contributors of this
|
|
8
8
|
|
9
9
|
== Install
|
10
10
|
|
11
|
-
|
11
|
+
gem install profanity_filter
|
12
|
+
or
|
13
|
+
./script/plugin install git://github.com/intridea/profanity_filter.git
|
12
14
|
|
13
15
|
== Example
|
14
16
|
|
@@ -74,14 +76,12 @@ You can run the benchmarks via:
|
|
74
76
|
|
75
77
|
== License
|
76
78
|
|
77
|
-
|
78
|
-
|
79
|
-
== Resources
|
80
|
-
|
81
|
-
Created by Adam Bair (adam@intridea.com) of Intridea (http://www.intridea.com) in the open source room at RailsConf 2008.
|
79
|
+
The Profanity Filter for Rails uses the MIT License. Please see the MIT-LICENSE file.
|
82
80
|
|
83
81
|
== Contributors
|
84
82
|
|
83
|
+
Created by Adam Bair (adam@intridea.com) of Intridea (http://www.intridea.com) in the open source room at RailsConf 2008. Originally called Fu-fu: The Profanity Filter for Rails.
|
84
|
+
|
85
85
|
* Paul Cortens and Greg Benedict - profane? method and tests.
|
86
86
|
* Neil Ang - punctionation delimited profanity
|
87
87
|
* Flinn Mueller - dynamic word list from method
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/lib/profanity_filter.rb
CHANGED
@@ -42,7 +42,10 @@ module ProfanityFilter
|
|
42
42
|
def banned?(word = '')
|
43
43
|
dictionary.include?(word.downcase) if word
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
|
+
def profane?(text = '')
|
47
|
+
text == clean(text) ? false : true
|
48
|
+
end
|
46
49
|
|
47
50
|
def clean(text, replace_method = '')
|
48
51
|
return text if text.blank?
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{profanity_filter}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Adam Bair"]
|
12
|
+
s.date = %q{2011-04-11}
|
13
|
+
s.description = %q{Allows you to filter profanity using basic replacement or a dictionary term.}
|
14
|
+
s.email = %q{adambair@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"MIT-LICENSE",
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"config/dictionary.yml",
|
24
|
+
"lib/profanity_filter.rb",
|
25
|
+
"profanity_filter.gemspec",
|
26
|
+
"test/benchmark/dictionary_test_100.yml",
|
27
|
+
"test/benchmark/dictionary_test_1000.yml",
|
28
|
+
"test/benchmark/dictionary_test_100000.yml",
|
29
|
+
"test/benchmark/dictionary_test_25000.yml",
|
30
|
+
"test/benchmark/dictionary_test_5000.yml",
|
31
|
+
"test/benchmark/dictionary_test_50000.yml",
|
32
|
+
"test/benchmark/fu-fu_benchmark.rb",
|
33
|
+
"test/benchmark/last_run.txt",
|
34
|
+
"test/benchmark/text_test_100.txt",
|
35
|
+
"test/benchmark/text_test_1000.txt",
|
36
|
+
"test/benchmark/text_test_10000.txt",
|
37
|
+
"test/benchmark/text_test_5000.txt",
|
38
|
+
"test/benign_filter_test.rb",
|
39
|
+
"test/connection_and_schema.rb",
|
40
|
+
"test/database.yml",
|
41
|
+
"test/destructive_filter_test.rb",
|
42
|
+
"test/profanity_filter_test.rb",
|
43
|
+
"test/schema.rb",
|
44
|
+
"test/test_harness.rb"
|
45
|
+
]
|
46
|
+
s.homepage = %q{http://github.com/intridea/profanity_filter}
|
47
|
+
s.licenses = ["MIT"]
|
48
|
+
s.require_paths = ["lib"]
|
49
|
+
s.rubygems_version = %q{1.6.2}
|
50
|
+
s.summary = %q{A Rails plugin gem for filtering out profanity.}
|
51
|
+
s.test_files = [
|
52
|
+
"test/benchmark/fu-fu_benchmark.rb",
|
53
|
+
"test/benign_filter_test.rb",
|
54
|
+
"test/connection_and_schema.rb",
|
55
|
+
"test/destructive_filter_test.rb",
|
56
|
+
"test/profanity_filter_test.rb",
|
57
|
+
"test/schema.rb",
|
58
|
+
"test/test_harness.rb"
|
59
|
+
]
|
60
|
+
|
61
|
+
if s.respond_to? :specification_version then
|
62
|
+
s.specification_version = 3
|
63
|
+
|
64
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
65
|
+
else
|
66
|
+
end
|
67
|
+
else
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
@@ -35,9 +35,16 @@ class BasicProfanityFilterTest < Test::Unit::TestCase
|
|
35
35
|
def test_knows_when_text_is_not_profane
|
36
36
|
assert !ProfanityFilter::Base.profane?('happy')
|
37
37
|
end
|
38
|
+
|
38
39
|
def test_knows_when_text_is_profane
|
39
40
|
assert ProfanityFilter::Base.profane?('fuck')
|
40
41
|
end
|
42
|
+
|
43
|
+
# Issue #1 https://github.com/intridea/profanity_filter/issues/1
|
44
|
+
def test_knows_when_text_contains_profanity
|
45
|
+
assert ProfanityFilter::Base.profane?('oh shit')
|
46
|
+
end
|
47
|
+
|
41
48
|
def test_knows_nil_is_not_profane
|
42
49
|
assert !ProfanityFilter::Base.profane?(nil)
|
43
50
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: profanity_filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Adam Bair
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-
|
18
|
+
date: 2011-04-11 00:00:00 -04:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -33,6 +34,7 @@ files:
|
|
33
34
|
- VERSION
|
34
35
|
- config/dictionary.yml
|
35
36
|
- lib/profanity_filter.rb
|
37
|
+
- profanity_filter.gemspec
|
36
38
|
- test/benchmark/dictionary_test_100.yml
|
37
39
|
- test/benchmark/dictionary_test_1000.yml
|
38
40
|
- test/benchmark/dictionary_test_100000.yml
|
@@ -62,23 +64,27 @@ rdoc_options: []
|
|
62
64
|
require_paths:
|
63
65
|
- lib
|
64
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
65
68
|
requirements:
|
66
69
|
- - ">="
|
67
70
|
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
68
72
|
segments:
|
69
73
|
- 0
|
70
74
|
version: "0"
|
71
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
72
77
|
requirements:
|
73
78
|
- - ">="
|
74
79
|
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
75
81
|
segments:
|
76
82
|
- 0
|
77
83
|
version: "0"
|
78
84
|
requirements: []
|
79
85
|
|
80
86
|
rubyforge_project:
|
81
|
-
rubygems_version: 1.
|
87
|
+
rubygems_version: 1.6.2
|
82
88
|
signing_key:
|
83
89
|
specification_version: 3
|
84
90
|
summary: A Rails plugin gem for filtering out profanity.
|