Class: Gluttonberg::Content::DespamilatorFilter::SpammyTLDs

Inherits:
Gluttonberg::Content::Despamilator::Filter show all
Defined in:
lib/gluttonberg/content/despamilator/filter/spammy_tlds.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



13
14
15
# File 'lib/gluttonberg/content/despamilator/filter/spammy_tlds.rb', line 13

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

#nameObject



9
10
11
# File 'lib/gluttonberg/content/despamilator/filter/spammy_tlds.rb', line 9

def name
  'Spammy TLDs'
end

#parse(subject) ⇒ Object



17
18
19
20
# File 'lib/gluttonberg/content/despamilator/filter/spammy_tlds.rb', line 17

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