Skip to content

Instantly share code, notes, and snippets.

@SebastianEdwards
Created September 2, 2011 03:29
Show Gist options
  • Save SebastianEdwards/1187863 to your computer and use it in GitHub Desktop.
Save SebastianEdwards/1187863 to your computer and use it in GitHub Desktop.
Collection = require './collection'
class Entity extends Collection
name: 'Guy'
talk: (msg) ->
return "#{@name} says: #{msg}"
Entity = require './entity'
bob = new Entity()
bob.name = 'Bob'
console.log bob.talk 'I am #{@name}. I am local to this process'
# output > I am Bob. I am local to this process
Entity = require './entity'
Entity.all (entities) ->
for entity in entity
console.log entity.talk "I am still #{@name} but I don't live here. This function was transparently called by RPC."
# output > I am still Bob but I don't live here. This function was transparently called by RPC.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment