Sha256: 7df814d821ebaaa05558ae90637946480b2d30df3b7a54a26a50127971ba4cfc

Contents?: true

Size: 357 Bytes

Versions: 34

Compression:

Stored size: 357 Bytes

Contents

# -*- encoding: utf-8 -*-
module Bluepill
  module Util
    class RotationalArray < Array
      def initialize(size)
        @capacity = size

        super() # no size - intentionally
      end

      def push(value)
        super(value)

        self.shift if self.length > @capacity
        self
      end
      alias_method :<<, :push
    end
  end
end

Version data entries

34 entries across 34 versions & 6 rubygems

Version Path
bluepill-rwgps-0.0.63 lib/bluepill/util/rotational_array.rb
bluepill-rwgps-0.0.62 lib/bluepill/util/rotational_array.rb
bluepill-rwgps-0.0.61 lib/bluepill/util/rotational_array.rb
cloud66-bluepill-0.0.64 lib/bluepill/util/rotational_array.rb
bluepill-0.0.68 lib/bluepill/util/rotational_array.rb
bluepill-0.0.67 lib/bluepill/util/rotational_array.rb
bluepill-rwgps-0.0.60 lib/bluepill/util/rotational_array.rb
bluepill-0.0.66 lib/bluepill/util/rotational_array.rb
bluepill-0.0.65 lib/bluepill/util/rotational_array.rb
bluepill-0.0.64 lib/bluepill/util/rotational_array.rb
cloud66-bluepill-0.0.63 lib/bluepill/util/rotational_array.rb
bluepill-0.0.63 lib/bluepill/util/rotational_array.rb
cloud66-bluepill-0.0.62 lib/bluepill/util/rotational_array.rb
bluepill-0.0.62 lib/bluepill/util/rotational_array.rb
bluepill-0.0.61 lib/bluepill/util/rotational_array.rb
kostya-bluepill-0.0.60.3 lib/bluepill/util/rotational_array.rb
kostya-bluepill-0.0.60.2 lib/bluepill/util/rotational_array.rb
kostya-bluepill-0.0.60.1 lib/bluepill/util/rotational_array.rb
skalar-bluepill-0.0.60.1 lib/bluepill/util/rotational_array.rb
bluepill-0.0.60 lib/bluepill/util/rotational_array.rb