Module: ActiveDryDeps::Deps
- Defined in:
- lib/active_dry_deps/deps.rb,
lib/active_dry_deps/stub.rb
Constant Summary collapse
- CONTAINER =
Container.new
Class Method Summary collapse
Class Method Details
.[](*keys, **aliases) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/active_dry_deps/deps.rb', line 14 def [](*keys, **aliases) m = Module.new receiver_methods = +"" keys.each do |resolver| receiver_methods << Dependency.new(resolver).receiver_method_string << "\n" end aliases.each do |alias_method, resolver| receiver_methods << Dependency.new(resolver, receiver_method_alias: alias_method).receiver_method_string << "\n" end m.module_eval(receiver_methods) m end |
.enable_stubs! ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/active_dry_deps/stub.rb', line 52 def self.enable_stubs! StubDeps.const_set(:ORIGINAL, Deps::CONTAINER.dup) StubDeps.const_set(:ORIGINAL_WITH_GLOBAL, Deps::CONTAINER.dup) Deps::CONTAINER.extend(StubContainer) Deps.extend StubDeps end |
.register ⇒ Object
31 32 33 |
# File 'lib/active_dry_deps/deps.rb', line 31 def register(...) CONTAINER.register(...) end |