Created
March 17, 2014 08:44
-
-
Save topliceanu/9595882 to your computer and use it in GitHub Desktop.
example of how to implement setters and getters in a coffeescript class. not accessible to children classes.
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
### | |
Utility to add setters and getters to a class in coffeescript. | |
@see https://github.com/thingdom/node-neo4j/blob/master/lib/PropertyContainer._coffee | |
### | |
class A | |
get = (props) => | |
@::__defineGetter__ name, getter for name, getter of props | |
set = (props) => | |
@::__defineSetter__ name, setter for name, setter of props |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment