Sha256: 1065023f998e61669b6ae4c44e4e591c965f3790e116fa936a386eae2ce7a723
Contents?: true
Size: 532 Bytes
Versions: 102
Compression:
Stored size: 532 Bytes
Contents
# Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.io/terms.html module Sqreen # A simple size limited queue. # When trying to enqueue more than the capacity # the older elements will get thrown class CappedQueue < Queue attr_reader :capacity def initialize(capacity) @capacity = capacity super() end alias original_push push def push(value) pop until size < @capacity original_push(value) end end end
Version data entries
102 entries across 102 versions & 2 rubygems