Skip to content

Commit

Permalink
Provide in TelegramInjector the PollFormatterInjector and no longer d…
Browse files Browse the repository at this point in the history
…epend on the replaced FormatterInjector
  • Loading branch information
alvarogzp committed May 31, 2018
1 parent 8cb328f commit ed9afae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion poll/inject/injector/all/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def telegram(self) -> TelegramInjector:
return self._cache(TelegramInjector, lambda: TelegramInjector(
self.cache,
self.domain(),
self._formatter(),
self._telegram_mapper(),
self.api
))
Expand Down
14 changes: 9 additions & 5 deletions poll/inject/injector/all/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@
from poll.inject.injector.presentation.mapper import MapperInjector
from poll.inject.injector.presentation.presenter import PresenterInjector
from poll.inject.injector.presentation.telegram.action import TelegramActionInjector
from poll.inject.injector.presentation.telegram.formatter import FormatterInjector
from poll.inject.injector.presentation.telegram.formatter.poll import PollFormatterInjector
from poll.inject.injector.presentation.telegram.mapper import TelegramMapperInjector
from poll.inject.injector.presentation.telegram.view import ViewInjector


class TelegramInjector(BaseInjector):
def __init__(self, cache: InjectorCache, domain: DomainInjector, formatter: FormatterInjector,
telegram_mapper: TelegramMapperInjector, api: Api):
def __init__(self, cache: InjectorCache, domain: DomainInjector, telegram_mapper: TelegramMapperInjector, api: Api):
super().__init__(cache)
self.domain = domain
self.formatter = formatter
self.telegram_mapper = telegram_mapper
self.api = api

Expand All @@ -39,10 +37,16 @@ def _presenter(self) -> PresenterInjector:
def _view(self) -> ViewInjector:
return self._cache(ViewInjector, lambda: ViewInjector(
self.cache,
self.formatter,
self._poll_formatter(),
self.api
))

def _poll_formatter(self) -> PollFormatterInjector:
return self._cache(PollFormatterInjector, lambda: PollFormatterInjector(
self.cache,
self.telegram_mapper
))

def _mapper(self) -> MapperInjector:
return self._cache(MapperInjector, lambda: MapperInjector(
self.cache
Expand Down

0 comments on commit ed9afae

Please sign in to comment.