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 Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ def moderate(options = {})

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

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

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

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

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

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

0 comments on commit 20feb5b

Please sign in to comment.