Class: Gluttonberg::Content::DespamilatorFilter::MixedCase

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

Instance Method Summary collapse

Instance Method Details

#descriptionObject



10
11
12
# File 'lib/gluttonberg/content/despamilator/filter/mixed_case.rb', line 10

def description
  'Detects mixed case strings.'
end

#nameObject



6
7
8
# File 'lib/gluttonberg/content/despamilator/filter/mixed_case.rb', line 6

def name
  'Mixed Case String'
end

#parse(subject) ⇒ Object



14
15
16
17
18
19
# File 'lib/gluttonberg/content/despamilator/filter/mixed_case.rb', line 14

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