Class: DespamilatorFilter::ObfuscatedURLs

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

Instance Method Summary collapse

Instance Method Details

#descriptionObject



8
9
10
# File 'lib/despamilator/filter/obfuscated_urls.rb', line 8

def description
  'Finds lame attempts at obfuscating urls.'
end

#nameObject



4
5
6
# File 'lib/despamilator/filter/obfuscated_urls.rb', line 4

def name
  'Obfuscated URLs'
end

#parse(subject) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/despamilator/filter/obfuscated_urls.rb', line 12

def parse subject
  text = subject.text.without_uris.downcase
  count = find_space_separated_parts text
  count += find_space_separated_characters text

  # weird maths below is due to some issue with ruby 1.9.2 multiplying floats by 3 (?!)
  subject.register_match!({:score => (4.0 * count) / 10, :filter => self}) if count > 0
end