Class: Dependo::Registry
- Inherits:
-
Object
- Object
- Dependo::Registry
- Defined in:
- lib/dependo.rb
Overview
Where dependencies are specified (or registered), and stored for future use
Constant Summary collapse
- @@attributes =
{}
Class Method Summary collapse
-
.[](key) ⇒ Object
The dependency registered with the given name.
- .[]=(key, value) ⇒ Object
-
.clear ⇒ Object
Remove all dependencies from the registry.
-
.has_key?(key) ⇒ Boolean
True if the name is registered, false otherwise.
Instance Method Summary collapse
-
#initialize ⇒ Registry
constructor
The Registry cannot be instantiated, so this constructor just fails.
Constructor Details
#initialize ⇒ Registry
The Registry cannot be instantiated, so this constructor just fails
11 12 13 |
# File 'lib/dependo.rb', line 11 def initialize raise "Cannot instantiate Dependo::Registry" end |
Class Method Details
.[](key) ⇒ Object
Returns the dependency registered with the given name.
23 24 25 |
# File 'lib/dependo.rb', line 23 def self.[](key) @@attributes[key] end |
.[]=(key, value) ⇒ Object
17 18 19 |
# File 'lib/dependo.rb', line 17 def self.[]=(key, value) @@attributes[key] = value end |
.clear ⇒ Object
Remove all dependencies from the registry
34 35 36 |
# File 'lib/dependo.rb', line 34 def self.clear @@attributes.clear end |
.has_key?(key) ⇒ Boolean
Returns true if the name is registered, false otherwise.
29 30 31 |
# File 'lib/dependo.rb', line 29 def self.has_key?(key) @@attributes.has_key?(key) end |