Advertisement
JordanScripter1337

Inheritance

Sep 19th, 2015
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. moduleKeywords =['extended,included']
  2. class module
  3.   @extend: (obj) ->
  4.     for key, value of obj when key not in moduleKeywords
  5.       @[key] = value
  6.    
  7.     obj.extended?.apply(@)
  8.     this
  9.   @include: (obj) ->
  10.     for key, value of obj when key not in moduleKeywords
  11.       @::[key] = value
  12.     obj.included?.apply(@)
  13.     this
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement