lib/redis/list.rb in redis-objects-0.9.1 vs lib/redis/list.rb in redis-objects-1.0.0
- old
+ new
@@ -68,12 +68,11 @@
# Same functionality as Ruby arrays. If a single number is given, return
# just the element at that index using Redis: LINDEX. Otherwise, return
# a range of values using Redis: LRANGE.
def [](index, length=nil)
if index.is_a? Range
- last = index.exclude_end? ? (index.last - 1) : index.last
- range(index.first, last)
+ range(index.first, index.max)
elsif length
case length <=> 0
when 1 then range(index, index + length - 1)
when 0 then []
when -1 then nil # Ruby does this (a bit weird)
@@ -142,8 +141,8 @@
def to_s
values.join(', ')
end
- expiration_filter :[]=, :push, :insert, :unshift
+ expiration_filter :[]=, :push, :<<, :insert, :unshift
end
end