Class: RSpec::Undefined::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/undefined/registry.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



8
9
10
11
# File 'lib/rspec/undefined/registry.rb', line 8

def initialize
  @mutex = Mutex.new
  @entries = []
end

Class Method Details

.instanceObject



28
29
30
# File 'lib/rspec/undefined/registry.rb', line 28

def self.instance
  @singleton_mutex.synchronize { @instance ||= new }
end

.reset!Object



32
33
34
# File 'lib/rspec/undefined/registry.rb', line 32

def self.reset!
  @singleton_mutex.synchronize { @instance = nil }
end

Instance Method Details

#add(entry) ⇒ Object



13
14
15
16
# File 'lib/rspec/undefined/registry.rb', line 13

def add(entry)
  @mutex.synchronize { @entries << entry }
  entry
end

#allObject



18
19
20
# File 'lib/rspec/undefined/registry.rb', line 18

def all
  @mutex.synchronize { @entries.dup }
end

#clearObject



22
23
24
# File 'lib/rspec/undefined/registry.rb', line 22

def clear
  @mutex.synchronize { @entries.clear }
end