Class: Tartarus::Registry
- Inherits:
-
Object
- Object
- Tartarus::Registry
- Extended by:
- Forwardable
- Defined in:
- lib/tartarus/registry.rb
Instance Method Summary collapse
- #find_by_name(name) ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #register(item) ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
11 12 13 |
# File 'lib/tartarus/registry.rb', line 11 def initialize reset end |
Instance Method Details
#find_by_name(name) ⇒ Object
19 20 21 |
# File 'lib/tartarus/registry.rb', line 19 def find_by_name(name) storage.find(->{ raise "#{name} not found in registry" }) { |item| item.name == name } end |
#register(item) ⇒ Object
15 16 17 |
# File 'lib/tartarus/registry.rb', line 15 def register(item) @storage << item end |
#reset ⇒ Object
23 24 25 |
# File 'lib/tartarus/registry.rb', line 23 def reset @storage = Concurrent::Array.new end |