Class: MockApi::StoreRegistry
- Inherits:
-
Object
- Object
- MockApi::StoreRegistry
- Includes:
- Singleton
- Defined in:
- lib/mock_api/store_registry.rb
Instance Method Summary collapse
- #find_or_create(name, entity_types) ⇒ Object
-
#initialize ⇒ StoreRegistry
constructor
A new instance of StoreRegistry.
Constructor Details
#initialize ⇒ StoreRegistry
Returns a new instance of StoreRegistry.
7 8 9 |
# File 'lib/mock_api/store_registry.rb', line 7 def initialize @stores = {} end |
Instance Method Details
#find_or_create(name, entity_types) ⇒ Object
11 12 13 14 |
# File 'lib/mock_api/store_registry.rb', line 11 def find_or_create(name, entity_types) return @stores[name] if @stores.key?(name) @stores[name] = Store.new(*entity_types) end |