Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Nola Stowe committed Apr 17, 2011
2 parents 11349e0 + 7a52b1e commit 93bff51
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.0
0.0.1
5 changes: 4 additions & 1 deletion lib/profanity_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ class << self
def banned?(word = '')
dictionary.include?(word.downcase) if word
end
alias :profane? :banned?

def profane?(text = '')
text == clean(text) ? false : true
end

def clean(text, replace_method = '')
return text if text.blank?
Expand Down
10 changes: 5 additions & 5 deletions profanity_filter.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

Gem::Specification.new do |s|
s.name = %q{profanity_filter}
s.version = "0.0.0"
s.version = "0.0.1"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Adam Bair"]
s.date = %q{2011-03-15}
s.date = %q{2011-04-11}
s.description = %q{Allows you to filter profanity using basic replacement or a dictionary term.}
s.email = %q{adambair@gmail.com}
s.extra_rdoc_files = [
Expand All @@ -22,6 +22,7 @@ Gem::Specification.new do |s|
"VERSION",
"config/dictionary.yml",
"lib/profanity_filter.rb",
"profanity_filter.gemspec",
"test/benchmark/dictionary_test_100.yml",
"test/benchmark/dictionary_test_1000.yml",
"test/benchmark/dictionary_test_100000.yml",
Expand All @@ -45,7 +46,7 @@ Gem::Specification.new do |s|
s.homepage = %q{http://github.com/intridea/profanity_filter}
s.licenses = ["MIT"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.6}
s.rubygems_version = %q{1.6.2}
s.summary = %q{A Rails plugin gem for filtering out profanity.}
s.test_files = [
"test/benchmark/fu-fu_benchmark.rb",
Expand All @@ -58,10 +59,9 @@ Gem::Specification.new do |s|
]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
else
end
else
Expand Down
7 changes: 7 additions & 0 deletions test/profanity_filter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@ def test_basic_profanity_filter_replaces_punctuation_spaced_profane_words
def test_knows_when_text_is_not_profane
assert !ProfanityFilter::Base.profane?('happy')
end

def test_knows_when_text_is_profane
assert ProfanityFilter::Base.profane?('fuck')
end

# Issue #1 https://github.com/intridea/profanity_filter/issues/1
def test_knows_when_text_contains_profanity
assert ProfanityFilter::Base.profane?('oh shit')
end

def test_knows_nil_is_not_profane
assert !ProfanityFilter::Base.profane?(nil)
end
Expand Down

0 comments on commit 93bff51

Please sign in to comment.