Class: DespamilatorFilter::MixedCase

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

Instance Method Summary collapse

Instance Method Details

#descriptionObject



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

def description
  'Detects mixed case strings.'
end

#nameObject



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

def name
  'Mixed Case String'
end

#parse(subject) ⇒ Object



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

def parse subject
  text = subject.text.without_uris
  count = text.remove_and_count!(/[a-z][A-Z]/)
  count += text.remove_and_count!(/[a-z][A-Z][a-z]/)
  subject.register_match!({:score => 0.1 * count, :filter => self}) if count > 0
end