Created
August 22, 2010 19:25
-
-
Save StanAngeloff/544159 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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