Sha256: 10d8d0fe95038c93a257f255f1602741d6394acad05932042309594ae75b7430

Contents?: true

Size: 539 Bytes

Versions: 14

Compression:

Stored size: 539 Bytes

Contents

module Vedeu

  # First-in first-out storage.
  #
  #   in -> [3] -> [2] -> [1] -> out
  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

14 entries across 14 versions & 1 rubygems

Version Path
vedeu-0.4.32 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.31 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.30 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.29 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.28 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.27 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.26 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.25 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.24 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.23 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.22 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.21 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.20 lib/vedeu/storage/fifo_store.rb
vedeu-0.4.19 lib/vedeu/storage/fifo_store.rb