Sha256: f03eb981fd4b10e391ed23819876e11780f09954f2b6fddd371c5905dbcd14fc

Contents?: true

Size: 371 Bytes

Versions: 2

Compression:

Stored size: 371 Bytes

Contents

module Basket
  class HashBackend
    attr_reader :data

    def initialize
      @data = {}
    end

    def push(queue, data)
      @data[queue] = [] if @data[queue].nil?
      @data[queue] <<= data
    end

    def length(queue)
      return 0 if @data[queue].nil?

      @data[queue].length
    end

    def pop_all(queue)
      @data.delete(queue)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
basket-0.0.2 lib/basket/hash_backend.rb
basket-0.0.1 lib/basket/hash_backend.rb