Skip to content

Instantly share code, notes, and snippets.

@gdotdesign
Created July 8, 2011 14:06
Show Gist options
  • Save gdotdesign/1071908 to your computer and use it in GitHub Desktop.
Save gdotdesign/1071908 to your computer and use it in GitHub Desktop.
Class.Alias
Class.Mutators.Alias = (data) ->
Object.each data, (value,key) =>
Array.each value, (a) =>
@::[a] = ->
@[key].attempt arguments, @
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