Class: Spy::RegistryStore
- Inherits:
-
Object
- Object
- Spy::RegistryStore
- Includes:
- Enumerable
- Defined in:
- lib/spy/registry_store.rb
Overview
Works with RegistryEntry abstractions to allow the store data structure to be easily swapped
Instance Method Summary collapse
- #each ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ RegistryStore
constructor
A new instance of RegistryStore.
- #insert(entry) ⇒ Object
- #remove(entry) ⇒ Object
Constructor Details
#initialize ⇒ RegistryStore
Returns a new instance of RegistryStore.
7 8 9 |
# File 'lib/spy/registry_store.rb', line 7 def initialize @internal = {} end |
Instance Method Details
#each ⇒ Object
19 20 21 22 |
# File 'lib/spy/registry_store.rb', line 19 def each return to_enum unless block_given? @internal.values.each { |v| yield v } end |
#empty? ⇒ Boolean
24 25 26 |
# File 'lib/spy/registry_store.rb', line 24 def empty? none? end |
#insert(entry) ⇒ Object
11 12 13 |
# File 'lib/spy/registry_store.rb', line 11 def insert(entry) @internal[entry.key] = entry end |
#remove(entry) ⇒ Object
15 16 17 |
# File 'lib/spy/registry_store.rb', line 15 def remove(entry) @internal.delete(entry.key) end |