class Utils::Grepper::Queue
def data
-
(Array)
- a duplicate of the internal data array
def data @data.dup end
def initialize(max_size)
-
max_size
(Integer
) -- the maximum size limit for the data storage
def initialize(max_size) @max_size, @data = max_size, [] end
def push(x)
-
(Queue)
- returns self to allow for method chaining
Parameters:
-
x
(Object
) -- the element to be added to the queue
def push(x) @data.shift if @data.size > @max_size @data << x self end