Skip to content

Instantly share code, notes, and snippets.

@LnL7
Created July 21, 2012 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LnL7/3156458 to your computer and use it in GitHub Desktop.
Save LnL7/3156458 to your computer and use it in GitHub Desktop.
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