class Concurrent::Channel::Buffer::Sliding

A non-blocking, buffered buffer of fixed maximum capacity. When the maximum capacity is reached subsequent {#put} and {#offer} operations will complete and the item will be `put`, but the oldest elements in the buffer will be discarded (not transferred).

Public Instance Methods

blocking?() click to toggle source

@!macro channel_buffer_blocking_question

Always returns `false`.

# File lib/concurrent/channel/buffer/sliding.rb, line 35
def blocking?
  false
end

Private Instance Methods

ns_full?() click to toggle source

@!macro channel_buffer_full_question

# File lib/concurrent/channel/buffer/sliding.rb, line 42
def ns_full?
  false
end
ns_put_onto_buffer(item) click to toggle source

@!macro channel_buffer_put

# File lib/concurrent/channel/buffer/sliding.rb, line 47
def ns_put_onto_buffer(item)
  buffer.shift if buffer.size == capacity
  buffer.push(item)
end