lib/redic.rb in redic-0.0.2 vs lib/redic.rb in redic-0.0.3
- old
+ new
@@ -1,25 +1,28 @@
-require "redis"
+require "redic/client"
class Redic
- def initialize(options = {})
- @client = Redis::Client.new(options)
+ attr :url
+
+ def initialize(url = "redis://127.0.0.1:6379")
+ @url = url
+ @client = Redic::Client.new(url)
@buffer = []
end
def call(*args)
- @client.send(:ensure_connected) do
+ @client.connect do
@client.write(args)
@client.read
end
end
def write(*args)
@buffer << args
end
def run
- @client.send(:ensure_connected) do
+ @client.connect do
@buffer.each do |args|
@client.write(args)
end
@buffer.map do