NoNo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in profanity_filter.gemspec
4
+ gemspec
data/README.markdown ADDED
@@ -0,0 +1,21 @@
1
+ NoNo
2
+ ================
3
+
4
+ NoNo is a simple Profanity Filter is a black-list based validator. Given a list of fields to check against, NoNo will ensure no content with any profanity is entered into the system.
5
+
6
+ ## Installation ##
7
+
8
+ Latest stable release:
9
+
10
+ gem "nono"
11
+
12
+ ## Usage ##
13
+
14
+ In the model you want to check for profanity its as simple as one line in the model.
15
+
16
+ class Article < ActiveRecord::Base
17
+ check_profanity
18
+ attr_accessible :body, :title
19
+ end
20
+
21
+ This will ensure no record will be saved into the system.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,48 @@
1
+ module NoNo
2
+ WORDS = %w(
3
+ 4r5e 5ht 5hit a55 anal anus ar5e arrse arse ass ass-fucker
4
+ asses assfucker assfukka asshole assholes asswhole a_s_s b!tch b00bs
5
+ b7ch btch ballbag balls ballsack bastard beastial beastiality bellend
6
+ bestial bestiality bi+ch biatch bitch bitcher bitchers bitches bitchin
7
+ bitching bloody blowjob blowjob blowjobs boiolas bollock bollok boner
8
+ boob boobs booobs boooobs booooobs booooooobs breasts buceta bugger bum
9
+ bunnyfucker butt butthole buttmuch buttplug c0ck c0cksucker carpetmuncher
10
+ cawk chink cipa clt clit clitoris clits cnut cock cock-sucker cockface
11
+ cockhead cockmunch cockmuncher cocks cocksuck cocksucked cocksucker
12
+ cocksucking cocksucks cocksuka cocksukka cok cokmuncher coksucka coon
13
+ cox crap cum cummer cumming cums cumshot cunilingus cunillingus cunnilingus
14
+ cunt cuntlick cuntlicker cuntlicking cunts cyalis cyberfuc
15
+ cyberfuck cyberfucked cyberfucker cyberfuckers cyberfucking dck
16
+ damn dick dickhead dildo dildos dink dinks dirsa dlck dog-fucker doggin
17
+ dogging donkeyribber doosh duche dyke ejaculate ejaculated ejaculates
18
+ ejaculating ejaculatings ejaculation ejakulate fuck fucker f4nny fag fagging
19
+ faggitt faggot faggs fagot fagots fags fanny fannyflaps fannyfucker fanyy fatass
20
+ fcuk fcuker fcuking feck fecker felching fellate fellatio fingerfuck fingerfucked
21
+ fingerfucker fingerfuckers fingerfucking fingerfucks fistfuck fistfucked
22
+ fistfucker fistfuckers fistfucking fistfuckings fistfucks flange fook fooker
23
+ fuck fucka fucked fucker fuckers fuckhead fuckheads fuckin fucking fuckings
24
+ fuckingshitmotherfucker fuckme fucks fuckwhit fuckwit fudgepacker
25
+ fudgepacker fuk fuker fukker fukkin fuks fukwhit fukwit fux fux0r f_u_c_k gangbang
26
+ gangbanged gangbangs gaylord gaysex goatse God god-dam god-damned goddamn goddamned
27
+ hardcoresex hell heshe hoar hoare hoer homo hore horniest horny hotsex jack-off jackoff jap
28
+ jerk-off jism jiz jizm jizz kawk knob knobead knobed knobend knobhead knobjocky knobjokey kock kondum
29
+ kondums kum kummer kumming kums kunilingus l3i+ch l3itch labia lmfao lust lusting m0f0 m0fo
30
+ m45terbate ma5terb8 ma5terbate masochist master-bate masterb8 masterbat* masterbat3 masterbate
31
+ masterbation masterbations masturbate mo-fo mof0 mofo mothafuck mothafucka mothafuckas mothafuckaz
32
+ mothafucked mothafucker mothafuckers mothafuckin mothafucking mothafuckings mothafucks motherfucker
33
+ motherfuck motherfucked motherfucker motherfuckers motherfuckin motherfucking motherfuckings
34
+ motherfuckka motherfucks muff mutha muthafecker muthafuckker muther mutherfucker ngga ngger nazi
35
+ nigg3r nigg4h nigga niggah niggas niggaz nigger niggers nob nobjokey nobhead nobjocky nobjokey
36
+ numbnuts nutsack orgasim orgasims orgasm orgasms p0rn pawn pecker penis penisfucker phonesex
37
+ phuck phuk phuked phuking phukked phukking phuks phuq pigfucker pimpis piss pissed pisser pissers
38
+ pisses pissflaps pissin pissing pissoff porn porno pornography pornos prick
39
+ pricks pron pube pusse pussi pussies pussy pussys rectum retard rimjaw rimming shit
40
+ s.o.b. sadist schlong screwing scroat scrote scrotum semen sex sh!+ sh!t sht shag shagger
41
+ shaggin shagging shemale shi+ shit shitdick shite shited shitey shitfuck shitfull shithead
42
+ shiting shitings shits shitted shitter shitters shitting shittings shitty skank slut sluts
43
+ smegma smut snatch son-of-a-bitch spac spunk s_h_i_t ttte5 ttties teets teez testical
44
+ testicle tit titfuck tits titt tittie5 tittiefucker titties tittyfuck tittywank titwank
45
+ tosser turd tw4t twat twathead twatty twunt twunter v4gra vgra vagina viagra vulva w00se wang
46
+ wank wanker wanky whoar whore willies willy xrated xxx
47
+ )
48
+ end
@@ -0,0 +1,3 @@
1
+ module NoNo
2
+ VERSION = "0.0.1"
3
+ end
data/lib/nono.rb ADDED
@@ -0,0 +1,33 @@
1
+ require "nono/version"
2
+ require "nono/banned_word"
3
+
4
+ module NoNo
5
+
6
+ module ClassMethods
7
+ def check_profanity
8
+ require 'sanitize'
9
+ validate :is_profane?
10
+ end
11
+ end
12
+
13
+ module InstanceMethods
14
+ def is_profane?
15
+
16
+ self.attributes.values.select{|x| !x.nil? }.each do |c|
17
+ if c.class == String
18
+ if WORDS.include? Sanitize.clean(c).gsub(/\r\n\t/, "").gsub(" ", "")
19
+ errors.add(:base, "Profanity found. This prevented the record from saving.")
20
+ return false
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ def self.included(base)
28
+ base.send :extend, ClassMethods
29
+ base.send :include, InstanceMethods
30
+ end
31
+ end
32
+
33
+ ActiveRecord::Base.send(:include, NoNo)
data/nono.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "nono/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "NoNo"
7
+ s.version = NoNo::VERSION
8
+ s.authors = ["Garrett Heinlen"]
9
+ s.email = ["heinleng@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{NoNo a simple profanity filter}
12
+ #s.description = %q{}
13
+
14
+ s.rubyforge_project = "nono"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ s.add_runtime_dependency "sanitize"
24
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: NoNo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Garrett Heinlen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sanitize
16
+ requirement: &70286680657020 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70286680657020
25
+ description:
26
+ email:
27
+ - heinleng@gmail.com
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - README.markdown
35
+ - Rakefile
36
+ - lib/nono.rb
37
+ - lib/nono/banned_word.rb
38
+ - lib/nono/version.rb
39
+ - nono.gemspec
40
+ homepage: ''
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project: nono
60
+ rubygems_version: 1.8.15
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: NoNo a simple profanity filter
64
+ test_files: []