Sha256: 366fe257c691254a4f34f88265831900644b00773d5bdf73e3b19647e0cb0fca
Contents?: true
Size: 757 Bytes
Versions: 12
Compression:
Stored size: 757 Bytes
Contents
require 'dry-container' module Coprl module ContainerMethods include Coprl::Symbol::ToStr def registered_keys @registered_keys ||= [] end def registered?(presenter) container.key?(sym_to_str(presenter)) end def [](name) resolve(name) end def resolve(name) container.resolve(sym_to_str(name)) end def list container.keys end alias keys list def container @container ||= Dry::Container.new end # This method empties out the container # It should ONLY be used for testing purposes def reset! registered_keys.each { |key| ClassConstants.new(key).deconstantize } @registered_keys = [] container._container.clear end end end
Version data entries
12 entries across 12 versions & 1 rubygems