Created
September 2, 2011 03:29
-
-
Save SebastianEdwards/1187863 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
Collection = require './collection' | |
class Entity extends Collection | |
name: 'Guy' | |
talk: (msg) -> | |
return "#{@name} says: #{msg}" |
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
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 |
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
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