Skip to content

thongdong7/tb-ioc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example

Factory

Create object by calling a static method of class.

services:
  MyService:
    factory: [my_package.my_file.MyFactoryClass, my_static_method_name]
    arguments: [...] # arguments for `my_static_method_name`
    calls: [...] # call to methods of returned object from factory

Create a factory object for class

Use to hide object class

services:
  AbcFactory:
    factory_class: my_package.abc.Abc

at another place, you could create Abc object by use AbcFactory instead of remember the long class name my_package.abc.Abc

services:
  MyAbc:
    factory: AbcFactory
    arguments: [arg1, arg2]

Calls

services:
  MyService:
    class: ...
    calls:
      - [method_without_arguments]
      - [method_with_arguments, [arg1, arg2]]

About

IOC (Inversion of control) for Python

Resources

Stars

Watchers

Forks

Packages

No packages published