Class: GeneralStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/burnspam/point_tracker.rb

Overview

The GeneralStrategy class stores the analysis methods that

can be common to both NameChecker and ContentChecker Strategy

It also stores a list of bad keywords for comments
and bad keywords for URLs

Version:: 0.1.1

Date:: 2011/12/18

@author:: Brian Burns, x10205284
@reference:: http://snook.ca/archives/other/effective_blog_comment_spam_blocker

Direct Known Subclasses

ContentCheckerStrategy, NameCheckerStrategy

Constant Summary collapse

@@comparisonwords =
["feck", "bitch"]
@@comparisonwordsurl =

Why use .de, .pl, .cn?

Answer:
Ask the author of this spam solution, referenced.
[".html", ".info", "?", "&", "free",
".de", ".pl", ".cn"]

Instance Method Summary collapse

Instance Method Details

#keywordsObject

The only method that is currently shared. All the others implement custom strategies. This method checks for bad keywords in the text



144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/burnspam/point_tracker.rb', line 144

def keywords
  @keywords_count = 0
  unless @keywords.empty? 
    @keywords.each do |word|
      @@comparisonwords.each do |word1|
        if word == word1
          @keywords_count += 1
        end
      end
    end
  end   
  @keywords_count
end

#testObject



158
159
160
# File 'lib/burnspam/point_tracker.rb', line 158

def test
  44
end