Class: Redis::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/celluloid/redis/redis_ext.rb

Instance Method Summary collapse

Instance Method Details

#_parse_driver(driver) ⇒ Object

Well this is really sad. redis-rb does not provide extensible driver support. Instead they couple everything together though this method. This leaves us no choice but to monkeypatch



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/celluloid/redis/redis_ext.rb', line 6

def _parse_driver(driver)
  driver = driver.to_s if driver.is_a?(Symbol)

  if driver.kind_of?(String)
    case driver
    when "ruby"
      require "redis/connection/ruby"
      driver = Connection::Ruby
    when "celluloid"
      require "redis/connection/celluloid"
      driver = Connection::Celluloid
    when "hiredis"
      require "redis/connection/hiredis"
      driver = Connection::Hiredis
    else
      raise "Unknown driver: #{driver}"
    end
  end

  driver
end