Skip to content

Instantly share code, notes, and snippets.

@tenedor
Created December 26, 2012 19:53
Show Gist options
  • Save tenedor/4382616 to your computer and use it in GitHub Desktop.
Save tenedor/4382616 to your computer and use it in GitHub Desktop.
class Model
# static
@prop: (prop) =>
(val) =>
# won't work - what is Model.set?
@set prop, val
# instance
prop: (prop) =>
(val) =>
# will work - model.set exists
@set prop, val
class ShellModel extends Model
# Model.get/set 'foo', val
foo: @prop 'foo'
# model.get 'bar'
bar: => (@prop 'bar')()
# model.get/set 'baz', val
baz: (val) => (@prop 'bar') val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment