Class: DespamilatorFilter::Prices

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

Instance Method Summary collapse

Instance Method Details

#descriptionObject



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

def description
  'Detects prices in text.'
end

#nameObject



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

def name
  'Prices'
end

#parse(subject) ⇒ Object



12
13
14
15
# File 'lib/despamilator/filter/prices.rb', line 12

def parse subject
  price_count = subject.text.count(/\$\s*\d+/)
  subject.register_match!({:score => 0.075 * price_count, :filter => self}) if price_count > 0
end