Refactoring of ProviderDelegate

This commit is contained in:
Roman Mogilatov 2015-02-25 01:48:51 +02:00
parent 76e14c1c79
commit 16799e414b
2 changed files with 23 additions and 2 deletions

View File

@ -1 +1 @@
0.4.1 0.4.2

View File

@ -41,7 +41,28 @@ class Provider(object):
""" """
Returns provider delegate. Returns provider delegate.
""" """
return self.__call__ return ProviderDelegate(self)
class ProviderDelegate(Provider):
"""
Provider's delegate.
"""
def __init__(self, delegated):
"""
Initializer.
:type delegated: Provider
"""
self.delegated = delegated
super(ProviderDelegate, self).__init__()
def __call__(self):
"""
Returns provided instance.
"""
return self.delegated.__call__
def prepare_injections(injections): def prepare_injections(injections):