mirror of
https://github.com/jimeh/redistat.git
synced 2026-02-19 13:26:39 +00:00
added class_name option to Model warpper for
customizing the scope used in Redis keys
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user