From a595e571128f4918c630275ca79781c7d15f7205 Mon Sep 17 00:00:00 2001 From: Jakub Stasiak Date: Thu, 13 Dec 2012 22:13:33 +0000 Subject: [PATCH] Update readme to match modified assisted injection API --- README.rst | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index c8540db..9bd9ef0 100644 --- a/README.rst +++ b/README.rst @@ -290,17 +290,13 @@ to inject objects of class ``User``. In this situation there's technique called Assisted injection:: - >>> UserUpdaterFactory = Key('UserUpdaterFactory') - >>> def module(binder): - ... binder.bind(UserUpdaterFactory, to=AssistedFactoryProvider(UserUpdater)) - ... injector = Injector(module) - ... factory = injector.get(UserUpdaterFactory) + ... builder = injector.get(AssistedBuilder(UserUpdater)) ... user = User('John') - ... user_updater = factory.create(user=user) + ... user_updater = builder.build(user=user) -This way we don't make ``UserUpdater`` directly injectable - we provide injectable factory. -Such factory has ``create(**kwargs)`` method which takes non-injectable parameters, combines +This way we don't make ``UserUpdater`` directly injectable - we provide injectable builder. +Such builder has ``build(**kwargs)`` method which takes non-injectable parameters, combines them with injectable dependencies of ``UserUpdater`` and calls ``UserUpdater`` initializer using all of them.