Module: Dim
- Defined in:
- lib/dim.rb,
lib/version.rb
Overview
– Copyright 2004, 2005, 2010, 2012 by Jim Weirich ([email protected]) and Mike Subelsky ([email protected])
All rights reserved.
This software is available under the MIT license. See the LICENSE file for details. ++
Dependency Injection - Minimal (DIM)
The DIM module provides a minimal dependency injection framework for Ruby programs.
Example:
require 'dim'
container = Dim::Container.new
container.register(:log_file) { "logfile.log" }
container.register(:logger) { |c| FileLogger.new(c.log_file) }
container.register(:application) { |c|
app = Application.new
app.logger = c.logger
app
}
c.application.run
Defined Under Namespace
Classes: Container
Constant Summary collapse
- MissingServiceError =
Thrown when a service cannot be located by name.
Class.new(StandardError)
- DuplicateServiceError =
Thrown when a duplicate service is registered.
Class.new(StandardError)
- EnvironmentVariableNotFound =
Thrown by register_env when a suitable ENV variable can’t be found
Class.new(StandardError)
- VERSION =
"1.2.5"