Class: EventedBluepill::Util::RotationalArray
- Inherits:
-
Array
- Object
- Array
- EventedBluepill::Util::RotationalArray
- Defined in:
- lib/evented_bluepill/util/rotational_array.rb
Instance Method Summary collapse
-
#initialize(size) ⇒ RotationalArray
constructor
A new instance of RotationalArray.
- #push(value) ⇒ Object (also: #<<)
Constructor Details
#initialize(size) ⇒ RotationalArray
Returns a new instance of RotationalArray.
6 7 8 9 10 |
# File 'lib/evented_bluepill/util/rotational_array.rb', line 6 def initialize(size) @capacity = size super() # no size - intentionally end |
Instance Method Details
#push(value) ⇒ Object Also known as: <<
12 13 14 15 16 17 |
# File 'lib/evented_bluepill/util/rotational_array.rb', line 12 def push(value) super(value) self.shift if self.length > @capacity self end |