lib/spank/ioc.rb in spank-1.0.1420314444 vs lib/spank/ioc.rb in spank-1.0.1441140793

- old
+ new

@@ -4,18 +4,29 @@ def bind_to(container) @@container = container end def resolve(symbol) - raise create_error unless class_variable_defined?(:@@container) + ensure_initialized! @@container.resolve(symbol) end + def resolve_all(symbol) + ensure_initialized! + @@container.resolve_all(symbol) + end + def unbind - remove_class_variable(:@@container) if class_variable_defined?(:@@container) + if class_variable_defined?(:@@container) + remove_class_variable(:@@container) + end end private + + def ensure_initialized! + raise create_error unless class_variable_defined?(:@@container) + end def create_error ContainerError.new("Spank::IOC.bind_to(container) has not been called.") end end