Sha256: 3cddb0c8e4248ef47a3364cd60452500b3ff79140e6fc19889aeebf27afb171b
Contents?: true
Size: 807 Bytes
Versions: 5
Compression:
Stored size: 807 Bytes
Contents
module Dependor module AutoInject module ClassMethods def look_in_modules(*modules) search_modules.concat(modules) end def search_modules @search_modules ||= [] end end def self.included(klass) klass.extend ClassMethods end def method_missing(name, *args, &block) auto_injector.get(name) end def respond_to?(name) auto_injector.resolvable?(name) end def inject(klass, overrides = {}) injector = Dependor::CustomizedInjector.new(auto_injector, overrides) instantiator = Dependor::Instantiator.new(injector) instantiator.instantiate(klass) end private def auto_injector @auto_injector ||= Dependor::AutoInjector.new(self, self.class.search_modules) end end end
Version data entries
5 entries across 5 versions & 1 rubygems