X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/4a327b4af9885d89b5860548f44569d1d2bde5ab..ad0ea27c83f23819c515116117413a1a86555c36:/client-libraries/ruby_2/rubyredis.rb?ds=sidebyside diff --git a/client-libraries/ruby_2/rubyredis.rb b/client-libraries/ruby_2/rubyredis.rb index 958210dc..9be390e3 100644 --- a/client-libraries/ruby_2/rubyredis.rb +++ b/client-libraries/ruby_2/rubyredis.rb @@ -20,6 +20,7 @@ class RedisClient @port = opts[:port] @db = opts[:db] @sock = connect_to_server + call_command(["select",@db]) if @db != 0 end def to_s @@ -46,6 +47,18 @@ class RedisClient read_reply end + def select(*args) + raise "SELECT not allowed, use the :db option when creating the object" + end + + def [](key) + get(key) + end + + def []=(key,value) + set(key,value) + end + def read_reply line = @sock.gets case line[0..0]