Class: Eye::Utils::Tail
- Inherits:
-
Array
- Object
- Array
- Eye::Utils::Tail
- Defined in:
- lib/eye/utils/tail.rb
Direct Known Subclasses
Instance Method Summary collapse
- #<<(el) ⇒ Object
-
#initialize(max_size = 100) ⇒ Tail
constructor
limited array.
- #push(el) ⇒ Object
Constructor Details
#initialize(max_size = 100) ⇒ Tail
limited array
5 6 7 8 |
# File 'lib/eye/utils/tail.rb', line 5 def initialize(max_size = 100) @max_size = max_size super() end |
Instance Method Details
#<<(el) ⇒ Object
16 17 18 |
# File 'lib/eye/utils/tail.rb', line 16 def << (el) push(el) end |
#push(el) ⇒ Object
10 11 12 13 14 |
# File 'lib/eye/utils/tail.rb', line 10 def push(el) super(el) shift if length > @max_size self end |