Sha256: d371335abb487d5891dc26344a635422654ddff8922e05abc25ca2b41c96c8b5
Contents?: true
Size: 512 Bytes
Versions: 130
Compression:
Stored size: 512 Bytes
Contents
class Allergies(object): _allergies = [ "eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats" ] def __init__(self, score): self.score = score def is_allergic_to(self, allergy): return bool(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
130 entries across 130 versions & 1 rubygems