lib/redis/base_object.rb in redis-objects-1.1.0 vs lib/redis/base_object.rb in redis-objects-1.2.0

- old
+ new

@@ -20,21 +20,10 @@ elsif !@options[:expireat].nil? redis.expireat(@key, @options[:expireat].to_i) if redis.ttl(@key) < 0 end end - class << self - def expiration_filter(*names) - names.each do |name| - # http://blog.jayfields.com/2006/12/ruby-alias-method-alternative.html - bind_method = instance_method(name) - - define_method(name) do |*args, &block| - result = bind_method.bind(self).call(*args, &block) - set_expiration - result - end - end - end + def allow_expiration(&block) + block.call.tap { set_expiration } end end end