Class: Dio::State Private
- Inherits:
-
Object
- Object
- Dio::State
- Defined in:
- lib/dio/state.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Dio::State holds some global states. This is used internally.
Instance Method Summary collapse
-
#initialize(injectors = Dio::InjectorStore.new) ⇒ State
constructor
private
A new instance of State.
-
#injector(id) ⇒ Object
private
Load an injector from the given ID.
- #register_injector(id, injector = nil) ⇒ Object private
-
#reset(injectors = {}) ⇒ Object
private
Reset whole states.
Constructor Details
#initialize(injectors = Dio::InjectorStore.new) ⇒ State
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of State.
10 11 12 |
# File 'lib/dio/state.rb', line 10 def initialize(injectors = Dio::InjectorStore.new) @injectors = injectors end |
Instance Method Details
#injector(id) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Load an injector from the given ID.
19 20 21 |
# File 'lib/dio/state.rb', line 19 def injector(id) @injectors.load(id) end |
#register_injector(id, injector = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/dio/state.rb', line 14 def register_injector(id, injector = nil) @injectors.register(id, injector) end |
#reset(injectors = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Reset whole states.
24 25 26 |
# File 'lib/dio/state.rb', line 24 def reset(injectors = {}) @injectors = Dio::InjectorStore.new(injectors) end |