Created
January 21, 2020 22:26
-
-
Save jenya239/b9f2b7870d855f6f2c818eafd9db4fcf 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
entity ={} | |
entity .prototype =entity | |
entity .base_create =( proto )-> #props? | |
res =Object .create proto | |
res .entity =entity | |
res | |
schema_prototype = | |
get_prototype: ->@_prototype | |
process: ( entity_schema )-> | |
init: ( @_prototype )-> | |
entity .schema =schema =entity .base_create schema_prototype #условно схема схемы | |
schema .name ='schema' | |
schema ._prototype =schema_prototype #? | |
entity .construction =construction =entity .base_create schema | |
construction .schema =schema #? | |
construction ._prototype = | |
process: ( @entity_schema, @args =[] )-> | |
@_entity =entity .base_create @entity_schema .get_prototype() | |
@_entity .schema =@entity_schema | |
@_entity .init( @args... ) if @_entity .init and @args .length > 0 #? | |
@entity_schema .process @_entity | |
entity .create =( entity_schema, args... )-> | |
entity_construction =entity .base_create construction ._prototype | |
entity_construction .process entity_schema, args | |
entity_construction ._entity | |
entity .create_schema =( name, args... )-> | |
res =entity .create schema, args... | |
res .name =name | |
res | |
exports =entity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment