Module: Dependor::Isolate
- Defined in:
- lib/dependor/isolate.rb
Instance Method Summary collapse
Instance Method Details
#isolate(klass = nil, overrides = {}, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/dependor/isolate.rb', line 3 def isolate(klass = nil, overrides = {}, &block) if block_given? klass = block.call caller_binding = block.binding injector = EvaluatingInjector.new(caller_binding) else sending_injector = SendingInjector.new(self) injector = CustomizedInjector.new(sending_injector, overrides) end dependecy_names = DependencyNamesCache.new instantiator = Instantiator.new(injector, dependecy_names) instantiator.instantiate(klass) end |