Class: Burnspam

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

Overview

The program takes a comment input as three paramaters: email, name and content. It performs some basic checks to determine the “spaminess” of a comment. Higher values are better while negative numbers are likely spam.

It also stores the most recent comments in memory and checks that new comments are not duplicates. If a new comment is found already existing in memory, the spaminess value goes down!

Version

0.1.1

Date

2011/12/18

@author

Brian Burns, x10205284

Burnspan.spaminess returns values:

  • spaminess < 0

    Obvious spam

  • spaminess 0 - 2

    Questionable quality

  • spaminess > 2

    Good quality comment

Defined Under Namespace

Classes: PointTracker

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email, name, content) ⇒ Burnspam

Analyse the comment



27
28
29
# File 'lib/burnspam.rb', line 27

def initialize(email, name, content)
  @points = PointTracker.new(email, name, content)
end

Instance Attribute Details

#pointsObject (readonly)

Returns the value of attribute points.



24
25
26
# File 'lib/burnspam.rb', line 24

def points
  @points
end

Instance Method Details

#spaminessObject

Return an int value of spaminess



32
33
34
# File 'lib/burnspam.rb', line 32

def spaminess
  @points.spaminess
end