Sha256: 49b203633c562f2ff309c19002e9903ba6b7f090039ef46238f563d7fc790b7a
Contents?: true
Size: 720 Bytes
Versions: 10
Compression:
Stored size: 720 Bytes
Contents
module Spank class IOC class << self def bind_to(container) @@container = container end def resolve(symbol) ensure_initialized! @@container.resolve(symbol) end def resolve_all(symbol) ensure_initialized! @@container.resolve_all(symbol) end def unbind 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 end end
Version data entries
10 entries across 10 versions & 1 rubygems