module MolassesJar::Extensions

Attributes

molasses_jar[RW]

Public Instance Methods

caught_something?() click to toggle source
# File lib/molasses_jar/extensions.rb, line 29
def caught_something?
  self.molasses_jar.present?
end
has_spam_attribute?() click to toggle source
# File lib/molasses_jar/extensions.rb, line 33
def has_spam_attribute?
  self.attributes.include?("spam")
end
mark_as_spam?() click to toggle source
# File lib/molasses_jar/extensions.rb, line 13
def mark_as_spam?
  if has_spam_attribute? and caught_something?
    self.spam = true
  elsif !has_spam_attribute? and caught_something?
    errors.add(:molasses_jar, "")
  end
end
spam?() click to toggle source
# File lib/molasses_jar/extensions.rb, line 21
def spam?
  if has_spam_attribute?
    self.spam
  else
    caught_something?
  end
end