Created
May 13, 2013 14:58
-
-
Save benshimmin/5568934 to your computer and use it in GitHub Desktop.
Tired of writing `new Foo` in CoffeeScript? Here, have Ruby's `Foo.new` instead!
This file contains hidden or 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
Object.defineProperty Object.prototype, "new", get : -> new @ | |
class Foo | |
constructor : -> console.log "foo!" | |
class Bar | |
constructor : -> console.log "bar!" | |
Foo.new # -> "foo!" | |
Bar.new # -> "bar!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment