class Semian::Simple::SlidingWindow

:nodoc:

def clear

def clear
  @window.clear
  self
end

def initialize(max_size:)

def initialize(max_size:)
  @max_size = max_size
  @window = []
end

def push(value)

def push(value)
  resize_to(@max_size - 1) # make room
  @window << value
  self
end

def reject!(&block)

def reject!(&block)
  @window.reject!(&block)
end

def resize_to(size)

def resize_to(size)
  @window = @window.last(size) if @window.size >= size
end