Skip to content

Instantly share code, notes, and snippets.

@topliceanu
Created March 17, 2014 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save topliceanu/9595882 to your computer and use it in GitHub Desktop.
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.
###
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