Class: Dry::System::ProviderRegistry
- Inherits:
-
Object
- Object
- Dry::System::ProviderRegistry
- Includes:
- Enumerable
- Defined in:
- lib/dry/system/provider_registry.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #[](identifier) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ ProviderRegistry
constructor
A new instance of ProviderRegistry.
- #register(identifier, options) ⇒ Object
Constructor Details
#initialize ⇒ ProviderRegistry
Returns a new instance of ProviderRegistry.
8 9 10 |
# File 'lib/dry/system/provider_registry.rb', line 8 def initialize @items = [] end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
6 7 8 |
# File 'lib/dry/system/provider_registry.rb', line 6 def items @items end |
Instance Method Details
#[](identifier) ⇒ Object
20 21 22 |
# File 'lib/dry/system/provider_registry.rb', line 20 def [](identifier) detect { |provider| provider.identifier == identifier } end |
#each(&block) ⇒ Object
12 13 14 |
# File 'lib/dry/system/provider_registry.rb', line 12 def each(&block) items.each(&block) end |