Class: DespamilatorFilter::NaughtyWords

Inherits:
Despamilator::Filter show all
Defined in:
lib/despamilator/filter/naughty_words.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



11
12
13
# File 'lib/despamilator/filter/naughty_words.rb', line 11

def description
  'Detects cheeky words'
end

#nameObject



7
8
9
# File 'lib/despamilator/filter/naughty_words.rb', line 7

def name
  'Naughty Words'
end

#naughty_wordsObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/despamilator/filter/naughty_words.rb', line 23

def naughty_words
  %w{
underage
penis
viagra
bondage
cunt
fuck
shit
dick
tits
nude
dicks
shemale
dildo
porn
cock
pussy
clit
preteen
lolita
   }
end

#parse(subject) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/despamilator/filter/naughty_words.rb', line 15

def parse subject
  text = subject.text.downcase

  naughty_words.each do |word|
    subject.register_match!({:score => 0.1, :filter => self}) if text =~ /\b#{word}s?\b/
  end
end