lib/redis/objects/sets.rb in redis-objects-1.3.0 vs lib/redis/objects/sets.rb in redis-objects-1.3.1
- old
+ new
@@ -13,14 +13,15 @@
module ClassMethods
# Define a new list. It will function like a regular instance
# method, so it can be used alongside ActiveRecord, DataMapper, etc.
def set(name, options={})
redis_objects[name.to_sym] = options.merge(:type => :set)
+ ivar_name = :"@#{name}"
mod = Module.new do
define_method(name) do
- instance_variable_get("@#{name}") or
- instance_variable_set("@#{name}",
+ instance_variable_get(ivar_name) or
+ instance_variable_set(ivar_name,
Redis::Set.new(
redis_field_key(name), redis_field_redis(name), redis_options(name)
)
)
end