Class: Ruvi::BufferListing
Instance Attribute Summary collapse
-
#open_buffers ⇒ Object
readonly
Returns the value of attribute open_buffers.
Instance Method Summary collapse
- #<<(buffer) ⇒ Object
- #clear ⇒ Object
- #delete(buffer) ⇒ Object
-
#initialize ⇒ BufferListing
constructor
A new instance of BufferListing.
Constructor Details
#initialize ⇒ BufferListing
Returns a new instance of BufferListing.
10 11 12 13 |
# File 'lib/buffer.rb', line 10 def initialize @id2buffer = {} @open_buffers = [] end |
Instance Attribute Details
#open_buffers ⇒ Object (readonly)
Returns the value of attribute open_buffers.
9 10 11 |
# File 'lib/buffer.rb', line 9 def open_buffers @open_buffers end |
Instance Method Details
#<<(buffer) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/buffer.rb', line 21 def << buffer @id2buffer[buffer.id] = buffer @open_buffers << buffer ObjectSpace.define_finalizer buffer, proc { |id| # puts "killing buffer #{id}" self.delete buffer } end |
#clear ⇒ Object
18 19 20 |
# File 'lib/buffer.rb', line 18 def clear @open_buffers.clear end |
#delete(buffer) ⇒ Object
14 15 16 17 |
# File 'lib/buffer.rb', line 14 def delete buffer @id2buffer @open_buffers.delete buffer end |