added class_name option to Model warpper for

customizing the scope used in Redis keys
This commit is contained in:
2010-12-29 17:26:22 +00:00
parent 0597b587fd
commit 115b223d7c
3 changed files with 22 additions and 1 deletions

View File

@@ -39,6 +39,15 @@ module Redistat
end
end
def class_name(class_name = nil)
if !class_name.nil?
options[:class_name] = class_name
else
options[:class_name] || nil
end
end
alias :scope :class_name
def depth(depth = nil)
if !depth.nil?
options[:depth] = depth
@@ -62,7 +71,7 @@ module Redistat
private
def name
@name ||= self.to_s
options[:class_name] || (@name ||= self.to_s)
end
end