Created
July 21, 2012 17:14
-
-
Save LnL7/3156458 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Serv | |
@instances: {} | |
@each: (cb) -> | |
for key,val of @instances | |
cb val | |
@get: (number) -> | |
@instances[number] | |
@update: (data) -> | |
if instance = @instances[data.number] | |
instance or= new Serv data.number | |
instance.update data | |
constructor: (@number) -> | |
Serv.instances[@number] = this | |
update: (data) -> | |
for key,val of data | |
@[key] = val | |
module.exports = Serv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment