Class: Rpush::Daemon::RingBuffer
- Inherits:
-
Array
- Object
- Array
- Rpush::Daemon::RingBuffer
- Defined in:
- lib/rpush/daemon/ring_buffer.rb
Instance Method Summary collapse
- #<<(obj) ⇒ Object (also: #push)
-
#initialize(max_size) ⇒ RingBuffer
constructor
A new instance of RingBuffer.
Constructor Details
#initialize(max_size) ⇒ RingBuffer
Returns a new instance of RingBuffer.
4 5 6 |
# File 'lib/rpush/daemon/ring_buffer.rb', line 4 def initialize(max_size) @max_size = max_size end |
Instance Method Details
#<<(obj) ⇒ Object Also known as: push
8 9 10 11 |
# File 'lib/rpush/daemon/ring_buffer.rb', line 8 def <<(obj) shift if size >= @max_size super end |