lib/redis/objects/values.rb in redis-objects-1.3.0 vs lib/redis/objects/values.rb in redis-objects-1.3.1
- old
+ new
@@ -13,14 +13,15 @@
module ClassMethods
# Define a new simple value. It will function like a regular instance
# method, so it can be used alongside ActiveRecord, DataMapper, etc.
def value(name, options={})
redis_objects[name.to_sym] = options.merge(:type => :value)
+ 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::Value.new(
redis_field_key(name), redis_field_redis(name), redis_options(name)
)
)
end