Module: RedisPrescription::Adapters

Defined in:
lib/redis_prescription/adapters.rb,
lib/redis_prescription/adapters/redis.rb,
lib/redis_prescription/adapters/redis_client.rb,
lib/redis_prescription/adapters/redis_namespace.rb

Defined Under Namespace

Modules: Redis, RedisClient, RedisNamespace

Class Method Summary collapse

Class Method Details

.[](redis) ⇒ Object

Raises:

  • (TypeError)


11
12
13
14
15
16
17
# File 'lib/redis_prescription/adapters.rb', line 11

def [](redis)
  return Adapters::Redis if Adapters::Redis.adapts?(redis)
  return Adapters::RedisClient if Adapters::RedisClient.adapts?(redis)
  return Adapters::RedisNamespace if Adapters::RedisNamespace.adapts?(redis)

  raise TypeError, "Unsupported redis client: #{redis.class}"
end