Skip to content

Instantly share code, notes, and snippets.

@brian-mann
Forked from airportyh/include.coffee
Created February 27, 2013 17:28
Show Gist options
  • Save brian-mann/5049785 to your computer and use it in GitHub Desktop.
Save brian-mann/5049785 to your computer and use it in GitHub Desktop.
CanSing =
sing: ->
console.log "I am #{@name} la la la"
include = (ctr, mixin) ->
console.log "including", ctr
for key of mixin
ctr.prototype[key] = mixin[key]
class Man
include(@, CanSing)
constructor: (@name) ->
console.log @name
brian = new Man('Brian')
brian.sing()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment