Sha256: d24f27e736ec401fa2b7eee8258583ef1adfd75beb03a42ea5a1cebd12be4faa
Contents?: true
Size: 577 Bytes
Versions: 396
Compression:
Stored size: 577 Bytes
Contents
local Clock = {} Clock.__index = Clock function Clock:__tostring() return string.format('%02d:%02d', math.floor(self.minutes / 60) % 24, self.minutes % 60) end Clock.tostring = Clock.__tostring function Clock:plus(minutes) self.minutes = self.minutes + minutes return self end function Clock:minus(minutes) self.minutes = self.minutes - minutes return self end function Clock:equals(other) return tostring(self) == tostring(other) end function Clock.at(hours, minutes) return setmetatable({ minutes = hours * 60 + (minutes or 0) }, Clock) end return Clock
Version data entries
396 entries across 396 versions & 1 rubygems