lib/redis/list.rb in redis-objects-0.6.1 vs lib/redis/list.rb in redis-objects-0.7.0
- old
+ new
@@ -11,21 +11,21 @@
require 'redis/helpers/core_commands'
include Redis::Helpers::CoreCommands
require 'redis/helpers/serialize'
include Redis::Helpers::Serialize
- attr_reader :key, :options, :redis
+ attr_reader :key, :options
# Works like push. Can chain together: list << 'a' << 'b'
def <<(value)
push(value)
self # for << 'a' << 'b'
end
- # Add a member before or after pivot in the list. Redis: LINSERT
- def insert(where,pivot,value)
- redis.linsert(key,where,to_redis(pivot),to_redis(value))
- end
+ # Add a member before or after pivot in the list. Redis: LINSERT
+ def insert(where,pivot,value)
+ redis.linsert(key,where,to_redis(pivot),to_redis(value))
+ end
# Add a member to the end of the list. Redis: RPUSH
def push(value)
redis.rpush(key, to_redis(value))
redis.ltrim(key, -options[:maxlength], -1) if options[:maxlength]