Skip to content

Instantly share code, notes, and snippets.

@Ezku
Created November 9, 2010 17:07
Show Gist options
  • Save Ezku/669399 to your computer and use it in GitHub Desktop.
Save Ezku/669399 to your computer and use it in GitHub Desktop.
class Behaviours
constructor: (@prototype) ->
attr_accessor: (attributes...) ->
for attr in attributes
value = null
@prototype['set_' + attr] = (v) -> value = v
@prototype['get_' + attr] = -> value
meta = (def) ->
def::meta.call(new Behaviours(def::))
def
meta class Foo
meta: ->
@attr_accessor 'bar'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment