lib/redis/value.rb in redis-objects-0.1.0 vs lib/redis/value.rb in redis-objects-0.1.1

- old
+ new

@@ -2,13 +2,13 @@ # # Class representing a simple value. You can use standard Ruby operations on it. # class Value attr_reader :key, :options, :redis - def initialize(key, options={}) + def initialize(key, redis=$redis, options={}) @key = key + @redis = redis @options = options - @redis = options[:redis] || $redis || Redis::Objects.redis @redis.setnx(key, @options[:default]) if @options[:default] end def value @value ||= get \ No newline at end of file