Skip to content

Commit

Permalink
more tweakage
Browse files Browse the repository at this point in the history
  • Loading branch information
rsl committed Apr 15, 2008
1 parent dfae80e commit 20feb5b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/lucky_sneaks/acts_as_snook.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ def moderate(options = {})


# Returns true if marked as spam, false otherwise # Returns true if marked as spam, false otherwise
def spam? def spam?
calculate_snook_score unless snook_credits calculate_snook_score unless already_calculated_snook
snook_spam_status == "spam" snook_spam_status == "spam"
end end


# Returns true if marked as ham (safe to display), false if spam # Returns true if marked as ham (safe to display), false if spam
def ham? def ham?
calculate_snook_score unless snook_credits calculate_snook_score unless already_calculated_snook
snook_spam_status == "ham" snook_spam_status == "ham"
end end


# Returns true if marked as spam, false otherwise # Returns true if marked as spam, false otherwise
def moderate? def moderate?
calculate_snook_score unless snook_credits calculate_snook_score unless already_calculated_snook
snook_spam_status == "moderate" snook_spam_status == "moderate"
end end


Expand All @@ -86,6 +86,10 @@ def ham!
end end


private private
def already_calculated_snook
self.send(self.class.fields_for_snooking[:spam_status_field]) || snook_credits
end

def calculate_snook_for_body_links def calculate_snook_for_body_links
link_count = snook_body.scan(/http:/).size link_count = snook_body.scan(/http:/).size
if link_count > 2 if link_count > 2
Expand Down

0 comments on commit 20feb5b

Please sign in to comment.