Sha256: ad2ba0b6456b5042e10113b9b31ab4b78db1fb0d275260dea67938f0d686b2d5
Contents?: true
Size: 580 Bytes
Versions: 4
Compression:
Stored size: 580 Bytes
Contents
require 'redis' require 'redis/connection/memory' module FakeRedis Redis = ::Redis def self.enable Redis::Connection.drivers << Redis::Connection::Memory unless enabled? end def self.enabled? Redis::Connection.drivers.last == Redis::Connection::Memory end def self.disable Redis::Connection.drivers.delete_if {|driver| Redis::Connection::Memory == driver } end def self.disabling return yield unless enabled? disable yield enable end def self.enabling return yield if enabled? enable yield disable end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fakeredis-0.9.2 | lib/fakeredis.rb |
fakeredis-0.9.1 | lib/fakeredis.rb |
fakeredis-0.9.0 | lib/fakeredis.rb |
fakeredis-0.8.0 | lib/fakeredis.rb |