Class: DespamilatorFilter::SpammyTLDs

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

Instance Method Summary collapse

Instance Method Details

#descriptionObject



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

def description
  'Detects TLDs that are more commonly associated with spam.'
end

#nameObject



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

def name
  'Spammy TLDs'
end

#parse(subject) ⇒ Object



15
16
17
18
# File 'lib/despamilator/filter/spammy_tlds.rb', line 15

def parse subject
  matches = subject.text.count(/\w{5,}\.(info|biz|xxx)\b/)
  subject.register_match!({:score => 0.05 * matches, :filter => self}) if matches > 0
end