Sha256: 744f910852e69c19901689dda2c14d2d009cdd6d89465ca5513f13082724d7b4

Contents?: true

Size: 560 Bytes

Versions: 8

Compression:

Stored size: 560 Bytes

Contents

module Vedeu

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

    include Vedeu::Store

    # @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

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.4.40 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.39 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.38 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.37 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.36 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.35 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.34 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.33 lib/vedeu/storage/fifo_store.rb