Class: Splam::Rules::GoodWords
- Inherits:
-
Splam::Rule
- Object
- Splam::Rule
- Splam::Rules::GoodWords
- Defined in:
- lib/splam/rules/good_words.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
#run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/splam/rules/good_words.rb', line 3 def run good_words = [ /I\'having a problem/, ] good_words |= %w( lighthouse lighthouseapp activereload warehouse install eclipse settings assigned user ticket tickets token api number query request) good_words |= %w( browser feed firefox safari skitch vendor rails action_controller railties ) good_words |= %w( redirect login diff dreamhost setup subversion git wildcard domain subdomain ssh database ) good_words |= %w( project billing tags description comment milestone saving happening feature mac implement report) good_words |= %w( rss notification subscribe calendar chart note task gantt search service ownership application communicate ) good_words |= %w( interaction API tickets hosted domain skitch ) good_words |= %w( pattern template web integer status xml activereload html state page rack diff ) good_words << "project management" good_words << "/usr/local/lib" << "gems" body = @body.downcase good_words.each { |rule| results = Regexp.new("\\b(#{rule})\\b","i").match(body) add_score -50 * results.size, "relevant word match: #{rule}" if results } end |