new files

This commit is contained in:
Ingy döt Net 2013-04-10 12:38:42 -07:00
parent 3af7344581
commit 86c034bb8b
1364 changed files with 21352 additions and 0 deletions

View file

@ -0,0 +1,24 @@
class Delegator
operation: ->
if @delegate and typeof (@delegate.thing) is "function"
return @delegate.thing()
"default implementation"
class Delegate
thing: ->
"Delegate Implementation"
testDelegator = ->
# Delegator with no delegate.
a = new Delegator()
console.log a.operation()
# Delegator with delegate not implementing "thing"
a.delegate = "A delegate may be any object"
console.log a.operation()
# Delegator with delegate that does implement "thing"
a.delegate = new Delegate()
console.log a.operation()
testDelegator()