Class: RSpec::Undefined::Registry
- Inherits:
-
Object
- Object
- RSpec::Undefined::Registry
- Defined in:
- lib/rspec/undefined/registry.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add(entry) ⇒ Object
- #all ⇒ Object
- #clear ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
Constructor Details
#initialize ⇒ Registry
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
.instance ⇒ Object
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 |
#all ⇒ Object
18 19 20 |
# File 'lib/rspec/undefined/registry.rb', line 18 def all @mutex.synchronize { @entries.dup } end |
#clear ⇒ Object
22 23 24 |
# File 'lib/rspec/undefined/registry.rb', line 22 def clear @mutex.synchronize { @entries.clear } end |