lib/ohm/collection.rb in ohm-0.0.36 vs lib/ohm/collection.rb in ohm-0.0.37
- old
+ new
@@ -122,11 +122,11 @@
db.lpush(key, value)
end
# @return [Array] Elements of the list.
def all
- db.lrange(key, 0, -1)
+ db.lrange(key, 0, -1) || []
end
# @return [Integer] Returns the number of elements in the list.
def size
db.llen(key)
@@ -169,10 +169,10 @@
def include?(value)
db.sismember(key, value)
end
def all
- db.smembers(key)
+ db.smembers(key) || []
end
# @return [Integer] Returns the number of elements in the set.
def size
db.scard(key)