root / elixir / trunk / elixir / statements.py @ 24

Revision 24, 0.6 kB (checked in by joshua, 6 years ago)

* created and added a pudge template (including css and two images)
* added a couple of (mostly empty) rst-files under /doc
* updated some docstrings, so that the generated html-files look prettier
* added setup.cfg and updated setup.py for pudge-integration
* copied docstring from init.py as long_description to setup.py

Line 
1class Statement(object):   
2    '''
3    DSL-style syntax
4   
5    A ``Statement`` object represents a DSL term.
6    '''
7   
8    statements = []
9   
10    def __init__(self, target):
11        self.target = target
12   
13    def __call__(self, *args, **kwargs):
14        Statement.statements.append((self, args, kwargs))
15   
16    @classmethod
17    def process(cls, entity):
18        '''
19        Apply all statements to the given entity.
20        '''
21       
22        for statement, args, kwargs in Statement.statements:
23            statement.target(entity, *args, **kwargs)
24        Statement.statements = []
Note: See TracBrowser for help on using the browser.