Skip to content

Instantly share code, notes, and snippets.

@StanAngeloff
Created August 22, 2010 19:25
Show Gist options
  • Save StanAngeloff/544159 to your computer and use it in GitHub Desktop.
Save StanAngeloff/544159 to your computer and use it in GitHub Desktop.
property = (instance, name) ->
instance[name] =
get: -> instance["_#{name}"]
set: (value) -> instance["_#{name}"] = value
get = (instance, route, block) ->
instance.routes[route] = type: 'get', block: block
put = (instance, route, block) ->
instance.routes[route] = type: 'put', block: block
class TaxModel extends Model
property @, 'rate' # the VAT, [0..1]
relation @, TaxClass
mixin: (instance, object) ->
(instance[key] = value) for key, value of object
class Router
get @, '/index', ->
# blah
put @, '/post/:id', ->
# blah
class Top
prop1: null
prop2: null
class Nested
mixin @, Top
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment