Module: Petli::Pet::Death
Instance Method Summary collapse
Methods included from Tatty::DB::Attributes
Instance Method Details
#check_if_dead ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/petli/pet/death.rb', line 8 def check_if_dead not_happy = self.happiness <= 1 not_healthy = self.health <= 1 is_sick = self.sick > 2 too_much_time = days_since(self.last_meal) >= 1 self.died_at = Time.now if not_happy && not_healthy && (is_sick || too_much_time) end |
#dead? ⇒ Boolean
16 17 18 |
# File 'lib/petli/pet/death.rb', line 16 def dead? !self.died_at.nil? end |