Created
July 8, 2011 14:06
-
-
Save gdotdesign/1071908 to your computer and use it in GitHub Desktop.
Class.Alias
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
Class.Mutators.Alias = (data) -> | |
Object.each data, (value,key) => | |
Array.each value, (a) => | |
@::[a] = -> | |
@[key].attempt arguments, @ |
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
a = new Class | |
Alias: | |
log: ['warn','error'] | |
log: (msg) -> | |
console.log msg | |
a.log "hello" | |
# prints hello | |
a.warn "warning" | |
# prints warning | |
a.error "error" | |
# prints error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment