Sha256: 28473c6f08666cd6a9b1f8405d02ef244601c91f682f81d551d83797ad0d81d5
Contents?: true
Size: 498 Bytes
Versions: 119
Compression:
Stored size: 498 Bytes
Contents
class Allergies: _allergies = [ "eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats" ] def __init__(self, score): self.score = score def is_allergic_to(self, allergy): return self.score & 1 << self._allergies.index(allergy) @property def lst(self): return [allergy for allergy in self._allergies if self.is_allergic_to(allergy)]
Version data entries
119 entries across 119 versions & 1 rubygems