Class: Spy::RegistryStore

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializeRegistryStore

Returns a new instance of RegistryStore.



7
8
9
# File 'lib/spy/registry_store.rb', line 7

def initialize
  @internal = {}
end

Instance Method Details

#eachObject



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

Returns:

  • (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