Sha256: 9d7f473dd2f1a8a9fb6014364e9b2c6eaf18cf1b1e6dbdbd5f8c8934b3b0faa4
Contents?: true
Size: 755 Bytes
Versions: 6
Compression:
Stored size: 755 Bytes
Contents
require 'dry-container' module Voom module ContainerMethods include Voom::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
6 entries across 6 versions & 1 rubygems