Sha256: 83415290e49e7bce1859652fd839e71de5fdb2f1696db0f7124d4c208214fc49
Contents?: true
Size: 587 Bytes
Versions: 37
Compression:
Stored size: 587 Bytes
Contents
class Clock(object): 'Clock that displays 24 hour clock that rollsover properly' def __init__(self, hour, minute): self.hour = hour self.minute = minute self.cleanup() def __repr__(self): return "{:02d}:{:02d}".format(self.hour, self.minute) def __eq__(self, other): return repr(self) == repr(other) def __add__(self, minutes): self.minute += minutes return self.cleanup() def cleanup(self): self.hour += self.minute // 60 self.hour %= 24 self.minute %= 60 return self
Version data entries
37 entries across 37 versions & 1 rubygems