Sha256: c3742d71ea941f7908923344b9f2565a687aeef2eddac609bb4e58fae96307e9

Contents?: true

Size: 424 Bytes

Versions: 1

Compression:

Stored size: 424 Bytes

Contents

require "forwardable"
require "thread"

module FakeServiceBus
  class MemoryDatabase
    extend Forwardable

    def_delegators :@queues,
      :[], :[]=, :delete, :each, :select, :values

    def initialize
      @semaphore = Mutex.new
    end

    def load
      @queues = {}
    end

    def transaction
      @semaphore.synchronize do
        yield
      end
    end

    def reset
      @queues = {}
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fake_servicebus-0.0.2 lib/fake_servicebus/databases/memory.rb