Class: RiderServer::Utils::FixedArray

Inherits:
Array show all
Defined in:
lib/rider_server/utils.rb

Instance Method Summary collapse

Methods inherited from Array

#rider_display

Constructor Details

#initialize(*args, max_size: 10) ⇒ FixedArray

Returns a new instance of FixedArray.



43
44
45
46
# File 'lib/rider_server/utils.rb', line 43

def initialize(*args, max_size: 10)
  @max_size = max_size
  super(*args)
end

Instance Method Details

#<<(element) ⇒ Object Also known as: push



48
49
50
51
# File 'lib/rider_server/utils.rb', line 48

def <<(element)
  super
  shift while size > @max_size
end