Class: Splam::Rules::Html

Inherits:
Splam::Rule show all
Defined in:
lib/splam/rules/html.rb

Instance Attribute Summary

Attributes inherited from Splam::Rule

#body, #reasons, #score, #suite, #weight

Instance Method Summary collapse

Methods inherited from Splam::Rule

#add_score, inherited, #initialize, #line_safe?, #name, run

Constructor Details

This class inherits a constructor from Splam::Rule

Instance Method Details

#runObject



3
4
5
6
7
8
9
10
11
# File 'lib/splam/rules/html.rb', line 3

def run
  # you get points for having lots of links
  add_score @body.scan(/\<[abi]/).size, "Lots of <a> <b> or <i> links"
  
  # stupid fools!
  add_score 5 * @body.scan(/<a[^>]*><b>/).size, "<b> inside an <a>"
  
  add_score(200, "Entire body is an HTML tag") if @body =~ /^[<][^>]*[>]$/
end