class Fifo

Public Class Methods

new(l) click to toggle source
Calls superclass method
# File lib/rgw/types.rb, line 55
def initialize l
    raise ArgumentError, "length has to be >= 1" if l.to_i < 1
    @lng = l.to_i
    super()
end

Public Instance Methods

<<(item)
Alias for: push
max() click to toggle source
# File lib/rgw/types.rb, line 66
def max
    @lng
end
push(item) click to toggle source
Calls superclass method
# File lib/rgw/types.rb, line 61
def push item
    super
    self.delete_at(0) if self.length > @lng
end
Also aliased as: <<
resize(l) click to toggle source
# File lib/rgw/types.rb, line 70
def resize l
    @lng = l
    while(self.length > @lng)
        self.delete_at(0)
    end
end