Paste: mixin/tuple inheritance

Author: jim mack
Mode: factor
Date: Wed, 15 Dec 2010 06:45:28
Plain Text |
! Copyright (C) 2010 James R. Mack.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors classes generic io kernel nested-comments
prettyprint sequences tools.test ;
IN: test

MIXIN: crud-list
MIXIN: crud-create
MIXIN: crud-read
MIXIN: crud-update
MIXIN: crud-delete

TUPLE: 4eyes-crud ;
TUPLE: 4eyes-locs < 4eyes-crud ;
TUPLE: locs-create < 4eyes-locs ;
TUPLE: locs-read < 4eyes-locs ;
TUPLE: locs-update < 4eyes-locs ;
TUPLE: locs-delete < 4eyes-locs ;
TUPLE: locs- < 4eyes-locs ; 

INSTANCE: locs-create crud-create
INSTANCE: locs-read crud-read
INSTANCE: locs-update crud-update
INSTANCE: locs-delete crud-delete
INSTANCE: 4eyes-locs crud-list
INSTANCE: locs- crud-list

GENERIC: content ( tpl -- str )

M: crud-create content ( tpl -- str )  class name>> " create" append ;
M: crud-read content ( tpl -- str )  class name>> " read" append ;
M: crud-update content ( tpl -- str )  class name>> " update" append ;
M: crud-delete content ( tpl -- str )  class name>> " delete" append ;
M: crud-list content ( tpl -- str ) class name>> " list" append ;

New Annotation

Summary:
Author:
Mode:
Body: