Sha256: 6b3df1e0628bc3ee146d0f45acbe707b6b32ba5579346f177ef544fc7e892153

Contents?: true

Size: 616 Bytes

Versions: 7

Compression:

Stored size: 616 Bytes

Contents

module Vedeu

  # First-in first-out storage.
  #
  #   in -> [3] -> [2] -> [1] -> out
  #
  # @api private
  class FifoStore

    include Vedeu::Store

    # Returns a new instance of Vedeu::FifoStore.
    #
    # @param storage [Array]
    # @return [Vedeu::FifoStore]
    def initialize(storage = [])
      @storage = storage
    end

    # @return [Object]
    def load
      storage.pop
    end

    # @param data [Object]
    # @return [Array<Object>]
    def save(data)
      storage.unshift(data)
    end

    private

    # @return [Array]
    def in_memory
      []
    end

  end # FifoStore

end # Vedeu

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vedeu-0.4.47 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.46 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.45 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.44 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.43 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.42 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.41 lib/vedeu/storage/fifo_store.rb