Class: Debugbar::MemoryBuffer
- Inherits:
-
Object
- Object
- Debugbar::MemoryBuffer
- Defined in:
- lib/debugbar/buffers/memory_buffer.rb
Instance Method Summary collapse
- #all ⇒ Object
- #clear! ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ MemoryBuffer
constructor
A new instance of MemoryBuffer.
- #push(request) ⇒ Object
- #remove(ids) ⇒ Object
Constructor Details
#initialize ⇒ MemoryBuffer
Returns a new instance of MemoryBuffer.
3 4 5 |
# File 'lib/debugbar/buffers/memory_buffer.rb', line 3 def initialize @collection = {} end |
Instance Method Details
#all ⇒ Object
20 21 22 |
# File 'lib/debugbar/buffers/memory_buffer.rb', line 20 def all @collection.values end |
#clear! ⇒ Object
29 30 31 32 |
# File 'lib/debugbar/buffers/memory_buffer.rb', line 29 def clear! @collection = {} :self end |
#each(&block) ⇒ Object
24 25 26 27 |
# File 'lib/debugbar/buffers/memory_buffer.rb', line 24 def each(&block) @collection.each(&block) :self end |
#push(request) ⇒ Object
7 8 9 10 |
# File 'lib/debugbar/buffers/memory_buffer.rb', line 7 def push(request) @collection[request.id] = request nil end |
#remove(ids) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/debugbar/buffers/memory_buffer.rb', line 12 def remove(ids) ids = Array.wrap(ids) ids.each do |id| @collection.delete(id) end :self end |