Class: DespamilatorFilter::VeryLongDomainName
- Inherits:
-
Despamilator::Filter
- Object
- Despamilator::Filter
- DespamilatorFilter::VeryLongDomainName
- Defined in:
- lib/despamilator/filter/very_long_domain_name.rb
Instance Method Summary collapse
Instance Method Details
#description ⇒ Object
12 13 14 |
# File 'lib/despamilator/filter/very_long_domain_name.rb', line 12 def description 'Detects unusually long domain names.' end |
#name ⇒ Object
8 9 10 |
# File 'lib/despamilator/filter/very_long_domain_name.rb', line 8 def name 'Very Long Domain Name' end |
#parse(subject) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/despamilator/filter/very_long_domain_name.rb', line 16 def parse subject subject.text.scan(URI.regexp).each do |url_parts| url_parts.compact! next if !url_parts[1] or url_parts[1] !~ /(\w|-){5,}\.\w{2,5}/ url = Domainatrix.parse('http://' + url_parts[1]) subject.register_match!({:score => 0.4, :filter => self}) if url.domain.length > 20 end end |