Class: Jerry
- Inherits:
-
Object
- Object
- Jerry
- Defined in:
- lib/jerry.rb,
lib/jerry/config.rb,
lib/jerry/errors.rb,
lib/jerry/version.rb,
lib/jerry/class_provider.rb
Overview
Inversion of Control container.
This class is in charge of bootstrapping your application. This is done by defining configs.
Defined Under Namespace
Classes: ClassProvider, Config, Error, InstantiationError
Constant Summary collapse
- VERSION =
'2.0.1'.freeze
Instance Method Summary collapse
-
#[](key) ⇒ Object
An insance of the sepcified key provided by one of the configs.
-
#initialize(*configs) ⇒ Jerry
constructor
A new instance of Jerry.
Constructor Details
#initialize(*configs) ⇒ Jerry
Returns a new instance of Jerry.
24 25 26 27 28 |
# File 'lib/jerry.rb', line 24 def initialize(*configs) configs.each { |conf| conf.jerry = self } @configs = configs end |
Instance Method Details
#[](key) ⇒ Object
Returns an insance of the sepcified key provided by one of the configs.
33 34 35 36 37 38 39 40 |
# File 'lib/jerry.rb', line 33 def [](key) config = @configs.find { |conf| conf.knows? key } unless config raise Jerry::InstantiationError, "Can't find #{key} in any config" end config[key] end |