Sha256: 2ed0b17a3ff27422d77b840c75a7ed548ae38a2bedbbeebb59df5c4a699b5e89
Contents?: true
Size: 751 Bytes
Versions: 1
Compression:
Stored size: 751 Bytes
Contents
require 'redis' module HellaRedis class ConnectionSpy attr_accessor :calls def initialize(config) @instance = ::Redis.new({ :url => config.url, :driver => config.driver }) @calls = [] end def pipelined @calls << ConnectionCall.new(:pipelined, []) yield self end def multi @calls << ConnectionCall.new(:multi, []) yield self end def method_missing(name, *args, &block) if self.respond_to?(name) @calls << ConnectionCall.new(name, args, block) else super end end def respond_to?(*args) super || @instance.respond_to?(*args) end ConnectionCall = Struct.new(:command, :args, :block) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hella-redis-0.4.0 | lib/hella-redis/connection_spy.rb |