Class: Tartarus::Registry

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/tartarus/registry.rb

Instance Method Summary collapse

Constructor Details

#initializeRegistry

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

#resetObject



23
24
25
# File 'lib/tartarus/registry.rb', line 23

def reset
  @storage = Concurrent::Array.new
end